pub struct Program<'code, const OPS: usize, const PORTS: usize = 8> { /* private fields */ }Expand description
A decoded, feed-forward block schedule. It can be prepared while another
program plays. OPS bounds the stored instructions. PORTS bounds the
signal inlets and outlets per object independently.
Implementations§
Source§impl<'code, const OPS: usize, const PORTS: usize> Program<'code, OPS, PORTS>
impl<'code, const OPS: usize, const PORTS: usize> Program<'code, OPS, PORTS>
Sourcepub fn decode(code: &'code [u8]) -> Result<Self, Error>
pub fn decode(code: &'code [u8]) -> Result<Self, Error>
Decode the wire format and validate its routing and resource bounds.
§Errors
Returns an error for invalid bytecode or exceeded capacities. Wire indices address up to 256 objects and 256 signal buses.
Sourcepub fn bind<'run, 'node, M, S>(
&'run self,
objects: &'run mut [&'node mut dyn Process<M, S>],
) -> Result<Patch<'run, 'node, M, S, PORTS>, Error>
pub fn bind<'run, 'node, M, S>( &'run self, objects: &'run mut [&'node mut dyn Process<M, S>], ) -> Result<Patch<'run, 'node, M, S, PORTS>, Error>
Bind application-owned processor instances to the program’s object indices.
§Errors
Returns Error::Object for missing instances and Error::Ports for
signal layouts that disagree with the bytecode.
Sourcepub fn bind_nodes<'run, 'node, M, S, P: Process<M, S> + ?Sized>(
&'run self,
objects: &'run mut [&'node mut P],
) -> Result<Patch<'run, 'node, M, S, PORTS, P>, Error>
pub fn bind_nodes<'run, 'node, M, S, P: Process<M, S> + ?Sized>( &'run self, objects: &'run mut [&'node mut P], ) -> Result<Patch<'run, 'node, M, S, PORTS, P>, Error>
Bind nodes while retaining their concrete type or trait-object bounds.
For example, a table of dyn Process<M, S> + Send produces a Send
patch that can be handed to an audio task.
§Errors
Returns the same object and port errors as Self::bind.