pub struct Banks<T>(/* private fields */);Expand description
Generic collection for BankFiles.
§Serialize/Deserialize
Neither Serialize nor Deserialize are implemented for this type.
§Box (no Copy)
The inner array of this type is wrapped in a Box.
– we cannot fit all BankFiles on the stack.
Unfortunately this means the type does not implement Copy.
§Example: Extending in your own code with custom inner types
use ot_tools_io::types::Banks;
use std::path::PathBuf;
use ot_tools_io::Defaults;
use ot_tools_io_derive::{ArrayDefaults, BoxedArrayDefaults};
use std::array::from_fn;
#[derive(Debug, PartialEq, Default, ArrayDefaults, BoxedArrayDefaults)]
pub struct YamlPath(PathBuf);
let mut my_bank_yamls = Banks::<YamlPath>::default();
let first = my_bank_yamls.first_mut().ok_or(())?;
*first = YamlPath(PathBuf::from("some_path"));
// first one changed
assert_eq!(my_bank_yamls[0], YamlPath(PathBuf::from("some_path")));
// rest are default
assert_eq!(my_bank_yamls[1], YamlPath::default());
// correct length
assert_eq!(my_bank_yamls.len(), 16);
Implementations§
Source§impl<T> Banks<T>
impl<T> Banks<T>
Source§impl<T> Banks<T>
impl<T> Banks<T>
Source§impl Banks<BankFile>
impl Banks<BankFile>
Sourcepub fn from_data_files<P>(
dirpath: P,
state: &SavedState,
) -> Result<Self, OtToolsIoError>
pub fn from_data_files<P>( dirpath: P, state: &SavedState, ) -> Result<Self, OtToolsIoError>
Reads a collection of BankFiles from a directory.
Sourcepub fn to_data_files<P>(
&self,
dirpath: P,
state: &SavedState,
skip_unchanged: bool,
) -> Result<(), OtToolsIoError>
pub fn to_data_files<P>( &self, dirpath: P, state: &SavedState, skip_unchanged: bool, ) -> Result<(), OtToolsIoError>
Trait Implementations§
impl<T: Eq> Eq for Banks<T>
Source§impl HasHeaderField for Banks<BankFile>
impl HasHeaderField for Banks<BankFile>
Source§fn check_header(&self) -> Result<bool, OtToolsIoError>
fn check_header(&self) -> Result<bool, OtToolsIoError>
Method to verify if header(s) are valid in some data.
See this thread. Read more
Source§impl<T: Ord> Ord for Banks<T>
impl<T: Ord> Ord for Banks<T>
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl<T: PartialOrd> PartialOrd for Banks<T>
impl<T: PartialOrd> PartialOrd for Banks<T>
impl<T: PartialEq> StructuralPartialEq for Banks<T>
Auto Trait Implementations§
impl<T> Freeze for Banks<T>
impl<T> RefUnwindSafe for Banks<T>where
T: RefUnwindSafe,
impl<T> Send for Banks<T>where
T: Send,
impl<T> Sync for Banks<T>where
T: Sync,
impl<T> Unpin for Banks<T>
impl<T> UnsafeUnpin for Banks<T>
impl<T> UnwindSafe for Banks<T>where
T: UnwindSafe,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.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