pub enum ScratchBuf {
}Expand description
One kernel-owned scratch buffer. A Ref2 output port’s
(ptr, len) buffer slots view its scratch — the kernel owns
the allocation, so the pointer is valid exactly as long as the
producing step doesn’t rerun (and a rerun rewrites the slots
before any consumer reads them). No Arc traffic, no allocation
after warmup: a string or byte string is rewritten in place, a
value is replaced.
Variants§
F32(Vec<f32>)
An f32 buffer.
F64(Vec<f64>)
An f64 buffer.
F16(Vec<f16>)
An f16 buffer.
I8(Vec<i8>)
An i8 buffer.
I16(Vec<i16>)
An i16 buffer.
I32(Vec<i32>)
An i32 buffer.
I64(Vec<i64>)
An i64 buffer.
Str(Vec<u8>)
The UTF-8 bytes of a string.
Bytes(Vec<u8>)
The bytes of a byte string.
Value(Vec<Value>)
One value held by reference; empty until the step first runs.
Slots(Vec<u64>)
A buffer of 64-bit slots (a native cone’s own).
Kernels(BodyKernels)
The kernels a tile render keeps over its projection bodies. A clone is empty: a new state builds its own.
State(NodeState)
State a node defines for itself, per kernel state. A clone is empty: a new state derives its own.
Implementations§
Source§impl ScratchBuf
impl ScratchBuf
Sourcepub fn ptr_len(&self) -> (u64, u64)
pub fn ptr_len(&self) -> (u64, u64)
The (ptr, len) pair this entry currently publishes —
the ground truth axiom S9(a)’s validator compares buffer
slots against.
Sourcepub fn to_value(&self) -> Value
pub fn to_value(&self) -> Value
What this entry holds as an owned Value, copied out: the
typed read of a Ref2 output on a compiled kernel, which is
what the interpreter’s pull returns for the same port. A
value entry that has not been written reads as None.
Sourcepub fn node_state(&mut self) -> &mut NodeState
pub fn node_state(&mut self) -> &mut NodeState
The node-defined state this entry holds. The entry must be a
State entry.
Sourcepub fn set_str(&mut self, s: &str)
pub fn set_str(&mut self, s: &str)
Replace the string this entry holds, reusing its allocation.
The entry must be a Str entry.
Sourcepub fn set_bytes(&mut self, b: &[u8])
pub fn set_bytes(&mut self, b: &[u8])
Replace the byte string this entry holds, reusing its
allocation. The entry must be a Bytes entry.
Sourcepub fn set_from_value(&mut self, v: &Value)
pub fn set_from_value(&mut self, v: &Value)
Fill this entry from v, whatever kind of entry it is.
The entry’s own variant decides, and it was allocated from the
step’s declared ScratchElem — so the type the graph resolved
picks the write, rather than a match over Value that has to be
extended every time the language grows a carrier. A value that
does not fit the entry is a graph that mis-typed the slot, and
the inner setters say so.
Sourcepub fn set_vector(&mut self, value: &Value)
pub fn set_vector(&mut self, value: &Value)
Replace the numeric vector this entry holds, reusing its allocation. The entry must be the matching element type.
The typed write path reaches a vector entry through the node’s
declared element type; this is the same write for the path that
only has a Value in hand (crate::derive_support::write_poly),
which is how a vector reaches a polymorphic node’s output.
Sourcepub fn set_value(&mut self, value: Value)
pub fn set_value(&mut self, value: Value)
Replace the value this entry holds. The entry must be a
Value entry.
Sourcepub fn set_ref_value(&mut self, value: Value)
pub fn set_ref_value(&mut self, value: Value)
Replace the value this entry holds with a by-reference value
that may be None. A None leaves the entry empty, so its
pair has length zero, which is how a Ref2 slot reads None.
The entry must be a Value entry.
Sourcepub fn new(elem: ScratchElem) -> Self
pub fn new(elem: ScratchElem) -> Self
An empty buffer of the element type.
Trait Implementations§
Source§impl Clone for ScratchBuf
impl Clone for ScratchBuf
Auto Trait Implementations§
impl !RefUnwindSafe for ScratchBuf
impl !UnwindSafe for ScratchBuf
impl Freeze for ScratchBuf
impl Send for ScratchBuf
impl Sync for ScratchBuf
impl Unpin for ScratchBuf
impl UnsafeUnpin for ScratchBuf
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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