[−][src]Struct nsi::arg::Reference
Reference type with lifetime guaratees.
Prefer this over using a raw Pointer
as it allows the compiler to check that
the data you reference outlives the
Context
you eventually send it to.
This gets converted to a raw pointer when passed through the FFI boundary.
struct Payload { some_data: u32, } let ctx = nsi::Context::new(&[]).unwrap(); // Lots of scene setup omitted ... // Setup a custom output driver and send // a payload to it through the FFI boundary ctx.create("driver", nsi::NodeType::OutputDriver, &[]); ctx.connect("driver", "", "beauty", "outputdrivers", &[]); let payload = Payload { some_data: 42, }; ctx.set_attribute( "driver", &[ nsi::string!("drivername", "custom_driver"), // Payload gets sent as raw pointer through // the FFI boundary. nsi::reference!("payload", Some(&payload)), ], ); // We need to explicitly call drop here as // ctx's lifetime is pegged to that of payload. drop(ctx);
Implementations
impl<'a> Reference<'a>
[src]
Trait Implementations
impl<'a, 'b> From<Reference<'b>> for ArgData<'a, 'b>
[src]
impl<'a, 'b> TryInto<Reference<'b>> for ArgData<'a, 'b>
[src]
Auto Trait Implementations
impl<'a> RefUnwindSafe for Reference<'a>
impl<'a> !Send for Reference<'a>
impl<'a> !Sync for Reference<'a>
impl<'a> Unpin for Reference<'a>
impl<'a> UnwindSafe for Reference<'a>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,