Enum nsi::ArgData

source ·
pub enum ArgData<'a, 'b> {
Show 23 variants Float(Float), Floats(Floats<'a>), Double(Double), Doubles(Doubles<'a>), Integer(Integer), Integers(Integers<'a>), String(String), Strings(Strings), Color(Color<'a>), Colors(Colors<'a>), Point(Point<'a>), Points(Points<'a>), Vector(Vector<'a>), Vectors(Vectors<'a>), Normal(Normal<'a>), Normals(Normals<'a>), Matrix(Matrix<'a>), Matrices(Matrices<'a>), DoubleMatrix(DoubleMatrix<'a>), DoubleMatrices(DoubleMatrices<'a>), Reference(Reference<'b>), References(References<'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§

§

Float(Float)

Single f32 value.

§

Floats(Floats<'a>)

An [f32] slice.

§

Double(Double)

Single f64 value.

§

Doubles(Doubles<'a>)

An [f64] slice.

§

Integer(Integer)

Single i32 value.

§

Integers(Integers<'a>)

An [i32] slice.

§

String(String)

A String.

§

Strings(Strings)

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.

§

Colors(Colors<'a>)

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

§

Point(Point<'a>)

Point, given as three f32 values.

§

Points(Points<'a>)

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

§

Vector(Vector<'a>)

Vector, given as three f32 values.

§

Vectors(Vectors<'a>)

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

§

Normal(Normal<'a>)

Normal vector, given as three f32 values.

§

Normals(Normals<'a>)

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

§

Matrix(Matrix<'a>)

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

§

Matrices(Matrices<'a>)

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

§

DoubleMatrix(DoubleMatrix<'a>)

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

§

DoubleMatrices(DoubleMatrices<'a>)

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

§

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,
}

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", Pin::new(&payload)),
    ],
);

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

References(References<'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 copy of the value. Read more
1.0.0 · 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<(), Error>

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<Colors<'a>> for ArgData<'a, 'b>

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

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

Converts to this type from the input type.
source§

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

source§

fn from(v: Matrix<'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<Normals<'a>> for ArgData<'a, 'b>

source§

fn from(v: Normals<'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<Points<'a>> for ArgData<'a, 'b>

source§

fn from(v: Points<'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<References<'b>> for ArgData<'a, 'b>

source§

fn from(v: References<'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<Strings> for ArgData<'a, 'b>

source§

fn from(v: Strings) -> 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<Vectors<'a>> for ArgData<'a, 'b>

source§

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

Converts to this type from the input type.
source§

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

§

type Error = &'static str

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

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

Performs the conversion.
source§

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

§

type Error = &'static str

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

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

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into( self ) -> Result<Colors<'a>, <ArgData<'a, 'b> as TryInto<Colors<'a>>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into(self) -> Result<Double, <ArgData<'a, 'b> as TryInto<Double>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into( self ) -> Result<DoubleMatrices<'a>, <ArgData<'a, 'b> as TryInto<DoubleMatrices<'a>>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into( self ) -> Result<DoubleMatrix<'a>, <ArgData<'a, 'b> as TryInto<DoubleMatrix<'a>>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into( self ) -> Result<Doubles<'a>, <ArgData<'a, 'b> as TryInto<Doubles<'a>>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into(self) -> Result<Float, <ArgData<'a, 'b> as TryInto<Float>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into( self ) -> Result<Floats<'a>, <ArgData<'a, 'b> as TryInto<Floats<'a>>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into( self ) -> Result<Integer, <ArgData<'a, 'b> as TryInto<Integer>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into( self ) -> Result<Integers<'a>, <ArgData<'a, 'b> as TryInto<Integers<'a>>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into( self ) -> Result<Matrices<'a>, <ArgData<'a, 'b> as TryInto<Matrices<'a>>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into( self ) -> Result<Matrix<'a>, <ArgData<'a, 'b> as TryInto<Matrix<'a>>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

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

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into( self ) -> Result<Normals<'a>, <ArgData<'a, 'b> as TryInto<Normals<'a>>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

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

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into( self ) -> Result<Points<'a>, <ArgData<'a, 'b> as TryInto<Points<'a>>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

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

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into( self ) -> Result<References<'b>, <ArgData<'a, 'b> as TryInto<References<'b>>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into(self) -> Result<String, <ArgData<'a, 'b> as TryInto<String>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into( self ) -> Result<Strings, <ArgData<'a, 'b> as TryInto<Strings>>::Error>

Performs the conversion.
source§

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

§

type Error = &'static str

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

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

Performs the conversion.
source§

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

§

type Error = &'static str

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

fn try_into( self ) -> Result<Vectors<'a>, <ArgData<'a, 'b> as TryInto<Vectors<'a>>>::Error>

Performs the conversion.

Auto Trait Implementations§

§

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> !UnwindSafe for ArgData<'a, 'b>

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V