Skip to main content

RValueRef

Struct RValueRef 

Source
pub struct RValueRef<T>
where T: ObjectRefCore,
{ /* private fields */ }
Expand description

An object argument that the callee may move out of, as ffi::RValueRef<T> in the ABI.

The callee may take the stored strong reference without incrementing its count. If it does not, the wrapper keeps the reference and releases it when dropped.

Implementations§

Source§

impl<T> RValueRef<T>
where T: ObjectRefCore,

Source

pub fn new(value: T) -> Self

Transfer an owned object reference into an rvalue argument slot.

Source

pub fn into_inner(self) -> T

Take the owned object without copying or incrementing its reference count.

§Panics

Panics if the object was already taken, such as by a callee that moved it out of the argument slot.

Trait Implementations§

Source§

impl<T> Drop for RValueRef<T>
where T: ObjectRefCore,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl<'a, T> From<&'a RValueRef<T>> for AnyView<'a>
where T: ObjectRefCore,

Source§

fn from(value: &'a RValueRef<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<T> for RValueRef<T>
where T: ObjectRefCore,

Source§

fn from(value: T) -> Self

Converts to this type from the input type.
Source§

impl<T: ObjectRefCore> PackedCallArg for RValueRef<T>

Source§

type Holder = RValueRef<T>

What keeps the argument alive during the call.
Source§

fn into_packed_arg(self) -> Self

Source§

fn as_packed_arg(holder: &Self::Holder) -> AnyView<'_>

Source§

impl<T> TryFrom<AnyView<'_>> for RValueRef<T>
where T: ObjectRefCore,

Source§

type Error = Error

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

fn try_from(value: AnyView<'_>) -> Result<Self>

Performs the conversion.

Auto Trait Implementations§

§

impl<T> !Freeze for RValueRef<T>

§

impl<T> !RefUnwindSafe for RValueRef<T>

§

impl<T> !Send for RValueRef<T>

§

impl<T> !Sync for RValueRef<T>

§

impl<T> Unpin for RValueRef<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for RValueRef<T>

§

impl<T> UnwindSafe for RValueRef<T>
where T: 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 = 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 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.
Source§

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