Struct show_notes::e013::Individual
source · pub struct Individual<'a> {
pub name: &'a str,
pub age: i16,
}
Expand description
An individual person defined in a way that includes a reference type.
The lifetime of the reference member, name
, needs to match the lifetime of
the Person
itself. We’d end up with a pretty weird scenario otherwise!
Note that the lifetimes of the members match the lifetime declared for the type itself, so the references must live at least as long as the instance of the type to which they’re attached.
Fields§
§name: &'a str
The person’s name, as a string reference.
age: i16
Just in case we’re talking about a character from Genesis
Implementations§
impl<'a> Individual<'a>
This impl block contains no items.
Note that the implementation block also has the lifetimes declared.
Auto Trait Implementations§
impl<'a> Freeze for Individual<'a>
impl<'a> RefUnwindSafe for Individual<'a>
impl<'a> Send for Individual<'a>
impl<'a> Sync for Individual<'a>
impl<'a> Unpin for Individual<'a>
impl<'a> UnwindSafe for Individual<'a>
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