pub struct Argument<'a> { /* private fields */ }Expand description
Implementations§
Source§impl Argument<'_>
impl Argument<'_>
Sourcepub fn is_borrowed(&self) -> bool
pub fn is_borrowed(&self) -> bool
Checks if the argument is borrowed.
Sourcepub fn to_mut(&mut self) -> &mut dyn Any
pub fn to_mut(&mut self) -> &mut dyn Any
Returns a mutable reference to the item itself.
If the inner contents are borrowed, this creates a new owned instance first before returning the reference itself.
Sourcepub fn to_owned(&self) -> Self
pub fn to_owned(&self) -> Self
Clones the inner contents of the object, returning an owned argument.
Sourcepub fn downcast_owned<T>(self) -> Result<T, Self>
pub fn downcast_owned<T>(self) -> Result<T, Self>
Downcasts an owned argument into type T, returning a result.
§Return values
Ok(T): The argument gets consumed and returns the inner contents. Err(Self): Either the argument is not of type T or the argument itself is not owned.
Sourcepub unsafe fn downcast_owned_unchecked<T>(self) -> T
pub unsafe fn downcast_owned_unchecked<T>(self) -> T
Sourcepub fn downcast_cloned<T>(&self) -> Option<T>
pub fn downcast_cloned<T>(&self) -> Option<T>
Downcasts the argument into a cloned object of type T.
Returns None if the object’s type is not T.
Sourcepub unsafe fn downcast_cloned_unchecked<T>(&self) -> T
pub unsafe fn downcast_cloned_unchecked<T>(&self) -> T
Downcasts the argument into a cloned object of T without checking it first.
§Safety
Assumes that the contents are of type T.
Source§impl<'a> Argument<'a>
impl<'a> Argument<'a>
Sourcepub fn new_borrowed<T>(item: &'a T) -> Self
pub fn new_borrowed<T>(item: &'a T) -> Self
Creates a borrowed argument of item T.
Sourcepub fn into_inner(self) -> ArgumentKind<'a>
pub fn into_inner(self) -> ArgumentKind<'a>
Consumes the argument itself, returning what kind of argument it is.