Struct noodles_cram::file_definition::FileDefinition
source · [−]pub struct FileDefinition { /* private fields */ }
Expand description
A CRAM file definition.
The CRAM file definition holds the format version and file ID. See § 6 File definition (2020-06-22).
Implementations
sourceimpl FileDefinition
impl FileDefinition
sourcepub fn new(version: Version, file_id: [u8; 20]) -> Self
pub fn new(version: Version, file_id: [u8; 20]) -> Self
Creates a file definition.
Examples
use noodles_cram::{file_definition::Version, FileDefinition};
let file_definition = FileDefinition::new(Version::new(3, 0), [0; 20]);
assert_eq!(file_definition.version(), Version::new(3, 0));
sourcepub fn version(&self) -> Version
pub fn version(&self) -> Version
Returns the file version.
This is also called the (major and minor) format number.
Examples
use noodles_cram::{file_definition::Version, FileDefinition};
let file_definition = FileDefinition::new(Version::new(3, 0), [0; 20]);
assert_eq!(file_definition.version(), Version::new(3, 0));
sourcepub fn file_id(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
pub fn file_id(&self) -> &[u8]ⓘNotable traits for &'_ [u8]impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]
Returns the file ID.
The file ID has a fixed length of 20 bytes. It can be any arbitrary identifier, e.g., the file name or a 160-bit checksum.
Examples
use noodles_cram::{file_definition::Version, FileDefinition};
let file_definition = FileDefinition::new(Version::new(3, 0), [0; 20]);
assert_eq!(file_definition.file_id(), [0; 20]);
Trait Implementations
sourceimpl Clone for FileDefinition
impl Clone for FileDefinition
sourcefn clone(&self) -> FileDefinition
fn clone(&self) -> FileDefinition
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for FileDefinition
impl Debug for FileDefinition
sourceimpl Default for FileDefinition
impl Default for FileDefinition
sourcefn default() -> FileDefinition
fn default() -> FileDefinition
Returns the “default value” for a type. Read more
sourceimpl PartialEq<FileDefinition> for FileDefinition
impl PartialEq<FileDefinition> for FileDefinition
sourcefn eq(&self, other: &FileDefinition) -> bool
fn eq(&self, other: &FileDefinition) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &FileDefinition) -> bool
fn ne(&self, other: &FileDefinition) -> bool
This method tests for !=
.
impl Eq for FileDefinition
impl StructuralEq for FileDefinition
impl StructuralPartialEq for FileDefinition
Auto Trait Implementations
impl RefUnwindSafe for FileDefinition
impl Send for FileDefinition
impl Sync for FileDefinition
impl Unpin for FileDefinition
impl UnwindSafe for FileDefinition
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more