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§

source§

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> 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> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.