Skip to main content

Node

Struct Node 

Source
#[non_exhaustive]
pub struct Node { /* private fields */ }
Expand description

One ɴsɪ node.

Implementations§

Source§

impl Node

Source

pub fn attributes(&self) -> impl Iterator<Item = (&str, &OwnedArgument)>

This node’s static attributes, by name.

Source

pub fn attribute(&self, name: &str) -> Option<&OwnedArgument>

One static attribute by name.

Use Node::effective unless you mean the static one specifically: an attribute set with SetAttributeAtTime is not here, and the renderer honours it.

Source

pub fn samples(&self) -> impl Iterator<Item = (&str, &[(f64, OwnedArgument)])>

This node’s sampled attributes, by name, each in call order.

Source

pub fn sample_calls(&self, name: &str) -> Option<&[(f64, OwnedArgument)]>

The calls that set one attribute at a time, in call order.

Source

pub fn f32(&self, name: &str) -> Option<f32>

One attribute as a single f32.

Reads the effective value – static or the last call at a time – and yields None when the attribute is absent or is not exactly one f32. A backend pulling one number out of a node wrote node.effective(name).and_then(OwnedArgument::as_f32) before this existed; twenty such sites in one backend’s flush path is what asked for these.

Source

pub fn f64(&self, name: &str) -> Option<f64>

One attribute as a single f64, on the same terms.

Source

pub fn i32(&self, name: &str) -> Option<i32>

One attribute as a single i32, on the same terms.

Source

pub fn flag(&self, name: &str) -> Option<bool>

One attribute as an ɴsɪ integer flag.

ɴsɪ writes booleans as int with 0 and 1 – withalpha, dithering, clockwisewinding – so this is the shape those are read in. Anything other than a single integer is None, which a caller replaces with the attribute’s documented default rather than with false.

Source

pub fn string(&self, name: &str) -> Option<&str>

One attribute as a single string.

None for a value that is not UTF-8, which is not the same as absent: an ɴsɪ string is bytes, and a file name on Linux need not be UTF-8. Use Node::bytes where the value may be a path; this is for the enumerants – "shader", "uint8", "color" – where UTF-8 is the whole vocabulary.

Source

pub fn bytes(&self, name: &str) -> Option<&[u8]>

One attribute as a single string’s raw bytes.

Source

pub fn node_type(&self) -> &str

The ɴsɪ node type this handle was created with.

Source

pub fn effective(&self, name: &str) -> Option<&OwnedArgument>

This node’s effective value for an attribute.

Use this, not Node::attributes. SetAttributeAtTime on an attribute that is not motion data sets it for the whole shutter, exactly as SetAttribute would: rendered, an attributes node whose visibility is set only through SetAttributeAtTime hides the object, identically to the static form. Reading Node::attributes alone answers “not set” for an attribute the renderer honours, which is a silent wrong answer – and was one here until it was rendered.

Static first, then the last call, which is not the sample at the greatest time – see Node::samples for the render that separates the two. The static value and the samples never coexist: set_attribute clears that name from the log and set_attribute_at_time clears the static value, which is ɴsɪ’s own rule and 3Delight’s behaviour.

This is what the resolver reads, so a backend asking a node directly gets the same answer the resolver would.

Trait Implementations§

Source§

impl Clone for Node

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 Node

Source§

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

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

impl Default for Node

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Node

Two nodes are equal when they say the same thing, which an absent table and an emptied one both do – delete_attribute leaves the second, and a scene compared against a replay of itself must not hinge on which one it holds.

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

Auto Trait Implementations§

§

impl Freeze for Node

§

impl RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

§

impl UnwindSafe for Node

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.