pub struct RefArg<'r, T> { /* private fields */ }
Expand description
Simple reference wrapper, used when passing arguments by-ref to Godot APIs.
This type is often used as the result of ToGodot::to_godot()
, if Self
is not a Copy
type.
Implementations§
Source§impl<'r, T> RefArg<'r, T>
impl<'r, T> RefArg<'r, T>
Sourcepub fn new(shared_ref: &'r T) -> Self
pub fn new(shared_ref: &'r T) -> Self
Creates a new RefArg
from a reference.
Unless you implement your own ToGodot
impl, there is usually no reason to use this.
Sourcepub fn get_ref_or_none(&self) -> Option<&T>where
T: GodotNullableFfi,
pub fn get_ref_or_none(&self) -> Option<&T>where
T: GodotNullableFfi,
Returns the stored reference.
Returns None
if T
is Option<Gd<...>>::None
.
Trait Implementations§
Source§impl<T> FromGodot for RefArg<'_, T>where
T: FromGodot,
impl<T> FromGodot for RefArg<'_, T>where
T: FromGodot,
Source§fn try_from_godot(_via: Self::Via) -> Result<Self, ConvertError>
fn try_from_godot(_via: Self::Via) -> Result<Self, ConvertError>
Converts the Godot representation to this type, returning
Err
on failure.Source§fn from_godot(via: Self::Via) -> Self
fn from_godot(via: Self::Via) -> Self
⚠️ Converts the Godot representation to this type. Read more
Source§fn try_from_variant(variant: &Variant) -> Result<Self, ConvertError>
fn try_from_variant(variant: &Variant) -> Result<Self, ConvertError>
Performs the conversion from a [
Variant
], returning Err
on failure.Source§fn from_variant(variant: &Variant) -> Self
fn from_variant(variant: &Variant) -> Self
⚠️ Performs the conversion from a [
Variant
]. Read moreSource§impl<T> GodotConvert for RefArg<'_, T>where
T: GodotConvert,
impl<T> GodotConvert for RefArg<'_, T>where
T: GodotConvert,
Source§type Via = <T as GodotConvert>::Via
type Via = <T as GodotConvert>::Via
The type through which
Self
is represented in Godot.Source§impl<T> GodotNullableFfi for RefArg<'_, T>where
T: GodotNullableFfi,
impl<T> GodotNullableFfi for RefArg<'_, T>where
T: GodotNullableFfi,
Source§impl<T> ToGodot for RefArg<'_, T>where
T: ToGodot,
impl<T> ToGodot for RefArg<'_, T>where
T: ToGodot,
Auto Trait Implementations§
impl<'r, T> Freeze for RefArg<'r, T>
impl<'r, T> RefUnwindSafe for RefArg<'r, T>where
T: RefUnwindSafe,
impl<'r, T> Send for RefArg<'r, T>where
T: Sync,
impl<'r, T> Sync for RefArg<'r, T>where
T: Sync,
impl<'r, T> Unpin for RefArg<'r, T>
impl<'r, T> UnwindSafe for RefArg<'r, T>where
T: 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