Skip to main content

ArgData

Enum ArgData 

Source
pub enum ArgData<'a, 'b> {
Show 26 variants F32(F32), F32Slice(F32Slice<'a>), F64(F64), F64Slice(F64Slice<'a>), I32(I32), I32Slice(I32Slice<'a>), I64(I64), I64Slice(I64Slice<'a>), String(String), StringSlice(StringSlice), Color(Color<'a>), ColorSlice(ColorSlice<'a>), Point(Point<'a>), PointSlice(PointSlice<'a>), Vector(Vector<'a>), VectorSlice(VectorSlice<'a>), Normal(Normal<'a>), NormalSlice(NormalSlice<'a>), MatrixF32(MatrixF32<'a>), MatrixF32Slice(MatrixF32Slice<'a>), MatrixF64(MatrixF64<'a>), MatrixF64Slice(MatrixF64Slice<'a>), Point4F32Slice(Point4F32Slice<'a>), Reference(Reference<'b>), ReferenceSlice(ReferenceSlice<'b>), Callback(Callback<'b>),
}
Expand description

A variant describing data passed to the renderer.

§Lifetimes

Lifetime 'a is for any tuple or array type as these are passed as references and only need to live as long as the function call where they get passed.

Lifetime 'b is for the arbitrary reference type. This is pegged to the lifetime of the Context. Use this to pass arbitrary Rust data through the FFI boundary.

Variants§

§

F32(F32)

Single [f32] value.

§

F32Slice(F32Slice<'a>)

An [f32] slice.

§

F64(F64)

Single [f64] value.

§

F64Slice(F64Slice<'a>)

An [f64] slice.

§

I32(I32)

Single [i32] value.

§

I32Slice(I32Slice<'a>)

An [i32] slice.

§

I64(I64)

Single [i64] value.

§

I64Slice(I64Slice<'a>)

An [i64] slice.

§

String(String)

A String.

§

StringSlice(StringSlice)

A String slice.

§

Color(Color<'a>)

Color in linear space, given as a red, green, blue triplet of [f32] values; usually in the range 0..1.

§

ColorSlice(ColorSlice<'a>)

A flat [f32] slice of colors (len % 3 == 0).

§

Point(Point<'a>)

Point, given as three [f32] values.

§

PointSlice(PointSlice<'a>)

A flat [f32] slice of points (len % 3 == 0).

§

Vector(Vector<'a>)

Vector, given as three [f32] values.

§

VectorSlice(VectorSlice<'a>)

A flat [f32] slice of vectors (len % 3 == 0).

§

Normal(Normal<'a>)

Normal vector, given as three [f32] values.

§

NormalSlice(NormalSlice<'a>)

A flat [f32] slice of normals (len % 3 == 0).

§

MatrixF32(MatrixF32<'a>)

Row-major, 4×4 transformation matrix, given as 16 [f32] values.

§

MatrixF32Slice(MatrixF32Slice<'a>)

A flat [f32] slice of matrices (len % 16 == 0).

§

MatrixF64(MatrixF64<'a>)

Row-major, 4×4 transformation matrix, given as 16 [f64] values.

§

MatrixF64Slice(MatrixF64Slice<'a>)

A flat [f64] slice of matrices (len % 16 == 0).

§

Point4F32Slice(Point4F32Slice<'a>)

A slice of 4-component f32 points (xyzw). Wire-side: a flat NSITypeFloat slice of 4 * N floats — the renderer groups them by attribute semantics. Use the point4_f32_slice! macro to keep &[[f32; 4]] ergonomics in Rust while the FFI sees the flat layout.

§

Reference(Reference<'b>)

Reference with lifetime guarantees.

This gets converted to a raw pointer when passed through the FFI boundary.

let ctx = nsi::Context::new(None).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::OUTPUT_DRIVER, None);
ctx.connect("driver", None, "beauty", "outputdrivers", None);

struct Payload {
    some_data: u32,
}

// Must use heap allocation for stable address
let payload = Box::new(Payload { some_data: 42 });
ctx.set_attribute(
    "driver",
    &[
        nsi::string!("drivername", "custom_driver"),
        // Payload gets sent as raw pointer through
        // the FFI boundary. The Box ensures stable address.
        nsi::reference!("payload", &payload),
    ],
);

// We need to explicitly call drop here as
// ctx's lifetime is pegged to that of payload.
drop(ctx);
§

ReferenceSlice(ReferenceSlice<'b>)

A Reference slice.

§

Callback(Callback<'b>)

A callback.

Trait Implementations§

Source§

impl<'a, 'b> Clone for ArgData<'a, 'b>

Source§

fn clone(&self) -> ArgData<'a, 'b>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, 'b> Debug for ArgData<'a, 'b>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, 'b> From<Callback<'b>> for ArgData<'a, 'b>

Source§

fn from(v: Callback<'b>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<Color<'a>> for ArgData<'a, 'b>

Source§

fn from(v: Color<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<ColorSlice<'a>> for ArgData<'a, 'b>

Source§

fn from(v: ColorSlice<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<F32> for ArgData<'a, 'b>

Source§

fn from(v: F32) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<F32Slice<'a>> for ArgData<'a, 'b>

Source§

fn from(v: F32Slice<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<F64> for ArgData<'a, 'b>

Source§

fn from(v: F64) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<F64Slice<'a>> for ArgData<'a, 'b>

Source§

fn from(v: F64Slice<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<I32> for ArgData<'a, 'b>

Source§

fn from(v: I32) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<I32Slice<'a>> for ArgData<'a, 'b>

Source§

fn from(v: I32Slice<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<I64> for ArgData<'a, 'b>

Source§

fn from(v: I64) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<I64Slice<'a>> for ArgData<'a, 'b>

Source§

fn from(v: I64Slice<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<MatrixF32<'a>> for ArgData<'a, 'b>

Source§

fn from(v: MatrixF32<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<MatrixF32Slice<'a>> for ArgData<'a, 'b>

Source§

fn from(v: MatrixF32Slice<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<MatrixF64<'a>> for ArgData<'a, 'b>

Source§

fn from(v: MatrixF64<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<MatrixF64Slice<'a>> for ArgData<'a, 'b>

Source§

fn from(v: MatrixF64Slice<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<Normal<'a>> for ArgData<'a, 'b>

Source§

fn from(v: Normal<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<NormalSlice<'a>> for ArgData<'a, 'b>

Source§

fn from(v: NormalSlice<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<Point<'a>> for ArgData<'a, 'b>

Source§

fn from(v: Point<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<Point4F32Slice<'a>> for ArgData<'a, 'b>

Source§

fn from(v: Point4F32Slice<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<PointSlice<'a>> for ArgData<'a, 'b>

Source§

fn from(v: PointSlice<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<Reference<'b>> for ArgData<'a, 'b>

Source§

fn from(v: Reference<'b>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<ReferenceSlice<'b>> for ArgData<'a, 'b>

Source§

fn from(v: ReferenceSlice<'b>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<String> for ArgData<'a, 'b>

Source§

fn from(v: String) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<StringSlice> for ArgData<'a, 'b>

Source§

fn from(v: StringSlice) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<Vector<'a>> for ArgData<'a, 'b>

Source§

fn from(v: Vector<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> From<VectorSlice<'a>> for ArgData<'a, 'b>

Source§

fn from(v: VectorSlice<'a>) -> ArgData<'a, 'b>

Converts to this type from the input type.
Source§

impl<'a, 'b> TryInto<Callback<'b>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<Callback<'b>, <Self as TryInto<Callback<'b>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<Color<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into(self) -> Result<Color<'a>, <Self as TryInto<Color<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<ColorSlice<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<ColorSlice<'a>, <Self as TryInto<ColorSlice<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<F32> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into(self) -> Result<F32, <Self as TryInto<F32>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<F32Slice<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<F32Slice<'a>, <Self as TryInto<F32Slice<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<F64> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into(self) -> Result<F64, <Self as TryInto<F64>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<F64Slice<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<F64Slice<'a>, <Self as TryInto<F64Slice<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<I32> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into(self) -> Result<I32, <Self as TryInto<I32>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<I32Slice<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<I32Slice<'a>, <Self as TryInto<I32Slice<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<I64> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into(self) -> Result<I64, <Self as TryInto<I64>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<I64Slice<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<I64Slice<'a>, <Self as TryInto<I64Slice<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<MatrixF32<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<MatrixF32<'a>, <Self as TryInto<MatrixF32<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<MatrixF32Slice<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<MatrixF32Slice<'a>, <Self as TryInto<MatrixF32Slice<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<MatrixF64<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<MatrixF64<'a>, <Self as TryInto<MatrixF64<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<MatrixF64Slice<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<MatrixF64Slice<'a>, <Self as TryInto<MatrixF64Slice<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<Normal<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into(self) -> Result<Normal<'a>, <Self as TryInto<Normal<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<NormalSlice<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<NormalSlice<'a>, <Self as TryInto<NormalSlice<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<Point<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into(self) -> Result<Point<'a>, <Self as TryInto<Point<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<Point4F32Slice<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<Point4F32Slice<'a>, <Self as TryInto<Point4F32Slice<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<PointSlice<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<PointSlice<'a>, <Self as TryInto<PointSlice<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<Reference<'b>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<Reference<'b>, <Self as TryInto<Reference<'b>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<ReferenceSlice<'b>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<ReferenceSlice<'b>, <Self as TryInto<ReferenceSlice<'b>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<String> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into(self) -> Result<String, <Self as TryInto<String>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<StringSlice> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into(self) -> Result<StringSlice, <Self as TryInto<StringSlice>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<Vector<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into(self) -> Result<Vector<'a>, <Self as TryInto<Vector<'a>>>::Error>

Performs the conversion.
Source§

impl<'a, 'b> TryInto<VectorSlice<'a>> for ArgData<'a, 'b>

Source§

type Error = &'static str

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

fn try_into( self, ) -> Result<VectorSlice<'a>, <Self as TryInto<VectorSlice<'a>>>::Error>

Performs the conversion.

Auto Trait Implementations§

§

impl<'a, 'b> Freeze for ArgData<'a, 'b>

§

impl<'a, 'b> RefUnwindSafe for ArgData<'a, 'b>

§

impl<'a, 'b> Send for ArgData<'a, 'b>
where 'b: 'static,

§

impl<'a, 'b> Sync for ArgData<'a, 'b>
where 'b: 'static,

§

impl<'a, 'b> Unpin for ArgData<'a, 'b>

§

impl<'a, 'b> UnsafeUnpin for ArgData<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for ArgData<'a, 'b>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.