Skip to main content

BaseRef

Struct BaseRef 

Source
pub struct BaseRef<Ctx, Id: Identifier> {
    pub id: Id,
    pub ctx: Ctx,
}
Expand description

A generic wrapper struct for referencing an ID with a context. This is the basis for all *Ref and *MutRef

Fields§

§id: Id§ctx: Ctx

Implementations§

Source§

impl<Ctx, Id: Identifier> BaseRef<Ctx, Id>

Source

pub fn new(ctx: Ctx, id: Id) -> Self

Source§

impl<Ctx, Id: Identifier> BaseRef<Ctx, Id>

Source

pub fn from_id(ctx: Ctx, id: Id) -> Self

Trait Implementations§

Source§

impl<'ctx, Ctx, Id: Identifier> From<BaseRef<&'ctx mut Ctx, Id>> for BaseRef<&'ctx Ctx, Id>

Convert mutable refs to immutable refs by cloning the ID and sharing the context reference.

Source§

fn from(r: BaseRef<&'ctx mut Ctx, Id>) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl<Ctx, Id> Freeze for BaseRef<Ctx, Id>
where Id: Freeze, Ctx: Freeze,

§

impl<Ctx, Id> RefUnwindSafe for BaseRef<Ctx, Id>
where Id: RefUnwindSafe, Ctx: RefUnwindSafe,

§

impl<Ctx, Id> Send for BaseRef<Ctx, Id>
where Id: Send, Ctx: Send,

§

impl<Ctx, Id> Sync for BaseRef<Ctx, Id>
where Id: Sync, Ctx: Sync,

§

impl<Ctx, Id> Unpin for BaseRef<Ctx, Id>
where Id: Unpin, Ctx: Unpin,

§

impl<Ctx, Id> UnsafeUnpin for BaseRef<Ctx, Id>
where Id: UnsafeUnpin, Ctx: UnsafeUnpin,

§

impl<Ctx, Id> UnwindSafe for BaseRef<Ctx, Id>
where Id: UnwindSafe, Ctx: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.