1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright (c) 2015-2016 Chris Palmer <pennstate5013@gmail.com>
// Use of this source code is governed by the LGPLv3 license that can be
// found in the LICENSE file.
//! The fields under source can be retrieved by using the methods under `Source`.
use channels::Source;
use url::Url;
impl Source {
/// Get the url that exists under `Source`.
///
/// # Examples
///
/// ```
/// use feed::channels::SourceBuilder;
///
/// let url = "http://www.tomalak.org/links2.xml";
///
/// let source = SourceBuilder::new()
/// .url(url)
/// .finalize();
///
/// assert_eq!(url.to_owned(), source.url().into_string());
/// ```
pub fn url(&self) -> Url {
self.url.clone()
}
/// Get the source that exists under `Source`.
///
/// # Examples
///
/// ```
/// use feed::channels::SourceBuilder;
///
/// let title = "Tomalak's Realm";
///
/// let url = "http://www.tomalak.org/links2.xml";
///
/// let source_obj = SourceBuilder::new()
/// .title(Some(title.to_owned()))
/// .url(url)
/// .finalize();
/// assert_eq!(title.to_owned(), source_obj.title().unwrap());
/// ```
pub fn title(&self) -> Option<String> {
self.title.clone()
}
}