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> From<DoubleMatrices<'a>> for ArgData<'a, 'b>
impl<'a, 'b> From<DoubleMatrices<'a>> for ArgData<'a, 'b>
Source§fn from(v: DoubleMatrices<'a>) -> ArgData<'a, 'b>
fn from(v: DoubleMatrices<'a>) -> ArgData<'a, 'b>
Source§impl<'a, 'b> From<DoubleMatrix<'a>> for ArgData<'a, 'b>
impl<'a, 'b> From<DoubleMatrix<'a>> for ArgData<'a, 'b>
Source§fn from(v: DoubleMatrix<'a>) -> ArgData<'a, 'b>
fn from(v: DoubleMatrix<'a>) -> ArgData<'a, 'b>
Source§impl<'a, 'b> From<References<'b>> for ArgData<'a, 'b>
impl<'a, 'b> From<References<'b>> for ArgData<'a, 'b>
Source§fn from(v: References<'b>) -> ArgData<'a, 'b>
fn from(v: References<'b>) -> ArgData<'a, 'b>
Source§impl<'a, 'b> TryInto<DoubleMatrices<'a>> for ArgData<'a, 'b>
impl<'a, 'b> TryInto<DoubleMatrices<'a>> for ArgData<'a, 'b>
Source§impl<'a, 'b> TryInto<DoubleMatrix<'a>> for ArgData<'a, 'b>
impl<'a, 'b> TryInto<DoubleMatrix<'a>> for ArgData<'a, 'b>
Source§impl<'a, 'b> TryInto<References<'b>> for ArgData<'a, 'b>
impl<'a, 'b> TryInto<References<'b>> for ArgData<'a, 'b>
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> !UnwindSafe for ArgData<'a, 'b>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more