pub enum OptRef<'a, T> {
Borrowed(&'a T),
Owned(T),
}Expand description
Represents either an owned or borrowed T.
Useful to pass T or &'a T to a function when used as Into<OptRef<'a, T>>.
It is defined in this crate, so the From trait can be implemented for foreigin types.
Variants§
Implementations§
Trait Implementations§
Source§impl<'a, P: Default> From<&'a ParagraphStyle<P>> for OptRef<'a, ParagraphStyle<P>>
impl<'a, P: Default> From<&'a ParagraphStyle<P>> for OptRef<'a, ParagraphStyle<P>>
Source§fn from(value: &'a ParagraphStyle<P>) -> Self
fn from(value: &'a ParagraphStyle<P>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<&'a RoundingRadii> for OptRef<'a, RoundingRadii>
impl<'a> From<&'a RoundingRadii> for OptRef<'a, RoundingRadii>
Source§fn from(value: &'a RoundingRadii) -> Self
fn from(value: &'a RoundingRadii) -> Self
Converts to this type from the input type.
Source§impl<'a, P: Default, S: Into<String>, P2: Into<Owned<P>>> From<(S, f32, P2)> for OptRef<'a, ParagraphStyle<P>>
impl<'a, P: Default, S: Into<String>, P2: Into<Owned<P>>> From<(S, f32, P2)> for OptRef<'a, ParagraphStyle<P>>
Source§impl<'a, P: Paint> From<ColorSource<<P as Paint>::Texture, <P as Paint>::ColorSourceFragment>> for OptRef<'a, P>
impl<'a, P: Paint> From<ColorSource<<P as Paint>::Texture, <P as Paint>::ColorSourceFragment>> for OptRef<'a, P>
Source§fn from(value: ColorSource<P::Texture, P::ColorSourceFragment>) -> Self
fn from(value: ColorSource<P::Texture, P::ColorSourceFragment>) -> Self
Converts to this type from the input type.
Source§impl<'a, P: Default> From<ParagraphStyle<P>> for OptRef<'a, ParagraphStyle<P>>
impl<'a, P: Default> From<ParagraphStyle<P>> for OptRef<'a, ParagraphStyle<P>>
Source§fn from(value: ParagraphStyle<P>) -> Self
fn from(value: ParagraphStyle<P>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<RoundingRadii> for OptRef<'a, RoundingRadii>
impl<'a> From<RoundingRadii> for OptRef<'a, RoundingRadii>
Source§fn from(value: RoundingRadii) -> Self
fn from(value: RoundingRadii) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl<'a, T> Freeze for OptRef<'a, T>where
T: Freeze,
impl<'a, T> RefUnwindSafe for OptRef<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for OptRef<'a, T>
impl<'a, T> Sync for OptRef<'a, T>where
T: Sync,
impl<'a, T> Unpin for OptRef<'a, T>where
T: Unpin,
impl<'a, T> UnwindSafe for OptRef<'a, T>where
T: UnwindSafe + RefUnwindSafe,
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