Skip to main content

OwnedData

Enum OwnedData 

Source
#[non_exhaustive]
pub enum OwnedData { F32(Vec<f32>), F64(Vec<f64>), I32(Vec<i32>), I64(Vec<i64>), String(Vec<Vec<u8>>), Reference(Vec<HostPointer>), }
Expand description

An ɴsɪ argument’s payload, owned.

Variants are storage representations, not ɴsɪ types: colour, point, vector, normal and 4x4 f32 matrices all live in OwnedData::F32 and are told apart by OwnedArgument::type_tag.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

F32(Vec<f32>)

f32 scalars, flattened. Also holds colour, point, vector, normal and 4x4 f32 matrices; OwnedArgument::type_tag tells them apart.

§

F64(Vec<f64>)

f64 scalars, flattened. Also holds 4x4 f64 matrices.

§

I32(Vec<i32>)

32-bit integers.

§

I64(Vec<i64>)

64-bit integers.

§

String(Vec<Vec<u8>>)

Strings, copied out of their C representation.

Bytes, not String. An ɴsɪ string is whatever the C API was handed. 3Delight writes a byte at or above 0x7f raw and reads it back unchanged, and a file name on Linux is not required to be UTF-8 – so an imagefilename naming café.exr in Latin-1 is a value this crate must carry, not one it may repair. Storing String here replaced the byte with U+FFFD at recording time, which no amount of care at replay could undo.

Use String::from_utf8_lossy where text is wanted.

§A path value may need expanding

ɴsɪ streams carry ${VAR} references so a scene can move between machines, and 3Delight expands them when it uses the value, not when it reads the stream. A backend that opens a path from here without expanding opens the wrong file – and only on the machines where the variable mattered, which is when it is hardest to diagnose.

The rules, measured rather than inferred, because each one changes what a backend must implement:

  • ${NAME} only. A bare $NAME is left alone: a probe naming $VAR/x.exr created a literal $VAR directory.
  • Path-valued attributes only. imagefilename, shaderfilename and Evaluate’s filename expand, and nest (${A}/${B}). drivername does not – it fails with E6024 cannot find display driver '${...}' – nor does a node handle (E6087 unknown node handle), nor an attribute name, which is silently ignored.
  • Any variable, not just NSI_PATH_. ${HOME} expands. That prefix governs which variables 3Delight writes as references under streampathreplacement; on read it means nothing.
  • An unset variable stays literal, rather than expanding to empty or erroring: a probe created a literal ${MISSING} directory.

One trap worth naming: ${...} in an output layer’s variablename segfaults 3Delight 2.9.207. Do not pass one through to a renderer expecting a diagnostic.

See specs/004 research Q1.

§

Reference(Vec<HostPointer>)

Raw host pointers. ɴsɪ calls this Reference (Pointer in the C API); it is not an object link and is never forwarded to a renderer as one. Stored so output-driver callbacks survive a replay. The recorder never dereferences these.

Trait Implementations§

Source§

impl Clone for OwnedData

Source§

fn clone(&self) -> Self

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 Debug for OwnedData

Source§

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

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

impl PartialEq for OwnedData

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for OwnedData

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.