Skip to main content

Record

Struct Record 

Source
pub struct Record { /* private fields */ }
Expand description

A validated record: verified canonical bytes from one retained source.

Its metadata (fields, links, By/Mark, lengths, containment) is always in memory. The complete bytes are available as one slice only where the source is contiguous; Record::read_at reads any source in bounded pieces. Clones share the source. Equality and hashing use the record hash.

Implementations§

Source§

impl Record

Source

pub fn from_bytes(bytes: impl Into<Vec<u8>>) -> Result<Record, RecordError>

Validate complete canonical record bytes (Lace-010) and own them.

Source

pub fn hash(&self) -> RecordHash

Source

pub fn kind(&self) -> RecordKind

Source

pub fn canonical_len(&self) -> usize

The complete canonical length in bytes.

Source

pub fn metadata(&self) -> RecordMetadata<'_>

The canonical non-payload prefix and everything derived from it.

Source

pub fn contiguous_bytes(&self) -> Option<&[u8]>

The complete canonical bytes, when the source holds them contiguously: memory and native mmap records, not file ranges.

Source

pub fn contiguous_data(&self) -> Option<&[u8]>

The Blob data, when the source holds it contiguously.

Source

pub fn read_at(&self, offset: usize, buffer: &mut [u8]) -> Result<usize, Error>

Copy canonical bytes starting at offset into buffer and return how many were copied: fewer than buffer.len() only at the record’s end. A file-range record reads its file at the matching position.

Source

pub fn to_vec(&self, limit: usize) -> Result<Vec<u8>, RecordReadError>

The complete canonical bytes, if at most limit bytes long.

Source

pub fn data_to_vec(&self, limit: usize) -> Result<Vec<u8>, RecordReadError>

The Blob data, if at most limit bytes long.

Trait Implementations§

Source§

impl Clone for Record

Source§

fn clone(&self) -> Record

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Record

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for Record

Source§

impl Hash for Record

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl IntoRecordBatch for Record

Source§

impl IntoRecordBatch for &Record

Source§

impl PartialEq for Record

Source§

fn eq(&self, other: &Record) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.