Trait sit_core::record::Record
[−]
[src]
pub trait Record { type Read: Read; type Hash: AsRef<[u8]>; type Str: AsRef<str>; type Iter: Iterator<Item = (Self::Str, Self::Read)>; fn hash(&self) -> Self::Hash; fn encoded_hash(&self) -> Self::Str; fn item_id(&self) -> Self::Str; fn file_iter(&self) -> Self::Iter; }
Record is an immutable collection of files
Associated Types
type Read: Read
Implementation's type for reading files
type Hash: AsRef<[u8]>
Implementation's type for non-encoded hash
type Str: AsRef<str>
Implementation's type for file names
type Iter: Iterator<Item = (Self::Str, Self::Read)>
Implementation's iterator type for listing files
Required Methods
fn hash(&self) -> Self::Hash
Returns record hash
fn encoded_hash(&self) -> Self::Str
Returns encoded record hash
The encoding is defined by its container (typically, the repository)
and is intended to be human-readable and it MUST be an encoding of the
byte array returned by hash
fn item_id(&self) -> Self::Str
Returns enclosing item's ID
fn file_iter(&self) -> Self::Iter
Returns an iterator over files in the record
Implementors
impl<'a, T: RecordTrait<Str = String, Hash = Vec<u8>> + RepositoryProvider + 'a> RecordTrait for DynamicallyHashedRecord<'a, T> type Read = T::Read; type Str = String; type Hash = Vec<u8>; type Iter = T::Iter;
impl<'a, S: AsRef<str>, R: Read, T: RecordTrait<Str = S, Read = R> + RepositoryProvider + 'a, F: Copy + Fn(&(S, R)) -> bool> RecordTrait for FilteredRecord<'a, S, R, T, F> type Read = T::Read; type Hash = T::Hash; type Str = T::Str; type Iter = Filter<T::Iter, F>;
impl<'a> RecordTrait for Record<'a> type Read = File; type Str = String; type Hash = Vec<u8>; type Iter = RecordFileIterator<'a>;