#[non_exhaustive]pub struct Person {
pub name: Option<SmallString>,
pub email: Option<Email>,
pub uri: Option<String>,
pub avatar: Option<String>,
pub json_extensions: HashMap<String, Value>,
}Expand description
Person (author, contributor, etc.)
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.name: Option<SmallString>Person’s name (stored inline for names ≤24 bytes)
email: Option<Email>Person’s email address
uri: Option<String>Person’s URI/website
avatar: Option<String>Person’s avatar image URL (JSON Feed only)
json_extensions: HashMap<String, Value>Custom JSON Feed _-prefixed members of this author.
Captured under the same caps as super::entry::Entry::json_extensions;
empty for every other format.
Implementations§
Source§impl Person
impl Person
Sourcepub fn from_name(name: impl AsRef<str>) -> Self
pub fn from_name(name: impl AsRef<str>) -> Self
Create person from just a name
§Examples
use feedparser_rs::types::Person;
let person = Person::from_name("John Doe");
assert_eq!(person.name.as_deref(), Some("John Doe"));
assert!(person.email.is_none());
assert!(person.uri.is_none());Sourcepub fn flat_string(&self) -> Option<SmallString>
pub fn flat_string(&self) -> Option<SmallString>
Build flat author string in "Name (email)" format when email is present.
Returns None if neither name nor email is set.
Trait Implementations§
Auto Trait Implementations§
impl Forget for Person
impl Freeze for Person
impl Move for Person
impl RefUnwindSafe for Person
impl Send for Person
impl Sync for Person
impl Unpin for Person
impl UnsafeUnpin for Personwhere
*const (): UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<(String, Value)>: UnsafeUnpin,
impl UnwindSafe for Person
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more