pub struct SliceStageRegistry { /* private fields */ }Expand description
A minimal slice-based stage registry.
This is the intended default for simple runtimes: define a static slice of stage entries and
resolve by name.
use byteor_pipeline_exec::{ResolvedStage, SliceStageRegistry, StageEntry, StageResolver};
fn identity() -> ResolvedStage {
ResolvedStage::MapOk(|input, output| {
let n = input.len().min(output.len());
output[..n].copy_from_slice(&input[..n]);
n
})
}
static STAGES: &[StageEntry] = &[StageEntry { name: "identity", factory: identity }];
let reg = SliceStageRegistry::new(STAGES);
assert!(reg.resolve("identity").is_some());Implementations§
Source§impl SliceStageRegistry
impl SliceStageRegistry
Sourcepub const fn new(entries: &'static [StageEntry]) -> Self
pub const fn new(entries: &'static [StageEntry]) -> Self
Create a registry from a slice of stage entries.
Sourcepub fn entries(&self) -> &'static [StageEntry]
pub fn entries(&self) -> &'static [StageEntry]
Access the underlying entries.
Trait Implementations§
Source§impl StageResolver for SliceStageRegistry
impl StageResolver for SliceStageRegistry
Auto Trait Implementations§
impl Freeze for SliceStageRegistry
impl RefUnwindSafe for SliceStageRegistry
impl Send for SliceStageRegistry
impl Sync for SliceStageRegistry
impl Unpin for SliceStageRegistry
impl UnwindSafe for SliceStageRegistry
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
Mutably borrows from an owned value. Read more