pub struct ExampleSet<'a> { /* private fields */ }Expand description
Zero-copy example set - indices into a shared buffer.
Implementations§
Source§impl<'a> ExampleSet<'a>
impl<'a> ExampleSet<'a>
Sourcepub const fn new(buffer: &'a Buffer, examples: &'a [ExampleMeta]) -> Self
pub const fn new(buffer: &'a Buffer, examples: &'a [ExampleMeta]) -> Self
Create a new example set.
Sourcepub fn from_buffer(buffer: Buffer, count: usize) -> ExampleSet<'static>
pub fn from_buffer(buffer: Buffer, count: usize) -> ExampleSet<'static>
Create from buffer with a specified count (for testing). This creates an example set with empty metadata but correct count.
Sourcepub fn get(&self, idx: usize) -> Option<&ExampleMeta>
pub fn get(&self, idx: usize) -> Option<&ExampleMeta>
Get example metadata by index.
Sourcepub fn iter(&self) -> impl Iterator<Item = ExampleView<'a>> + '_
pub fn iter(&self) -> impl Iterator<Item = ExampleView<'a>> + '_
Iterate over examples.
Auto Trait Implementations§
impl<'a> Freeze for ExampleSet<'a>
impl<'a> RefUnwindSafe for ExampleSet<'a>
impl<'a> Send for ExampleSet<'a>
impl<'a> Sync for ExampleSet<'a>
impl<'a> Unpin for ExampleSet<'a>
impl<'a> UnsafeUnpin for ExampleSet<'a>
impl<'a> UnwindSafe for ExampleSet<'a>
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
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>
Converts
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>
Converts
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