Skip to main content

EncodeContext

Struct EncodeContext 

Source
#[non_exhaustive]
pub struct EncodeContext<'a> { pub source_id: i64, pub source_uuid: Option<&'a str>, pub stream: &'a str, }
Available on crate feature archive only.
Expand description

Which stream an encode is for, and whose: what an encoder is told beside the rows. See SegmentEncoder::encode.

A stream name is unique only within its source, and one writer can hold several sources with the same stream names (two hosts recording cpu), so an encoder that keeps per-stream state, such as labels a long table states once, keys it by source as well as by stream.

Key state that outlives one archive by source_uuid, which a plain copy carries unchanged; source_id is unique only within one file, and a copy renumbers it. source_uuid is None for a source from before the column, and a copy mints one for the destination that the encoder is not told. So does a copy kept under a fresh uuid (rewrite::copy_sources_into_as_copies); later seals of its live rows pass the minted one.

A copy passes the source archive’s id and uuid, because the rows it encodes (the live tail it carries across) are that source’s, and an encoder’s state about them was built under that key. A ranged copy can leave out earlier segments that a state-carrying encoder’s output depended on, such as the segment that stated a long table’s labels; the copy cannot tell, so such an encoder must not assume that what it emitted for a source before is in the destination.

#[non_exhaustive]: fields are added without a breaking release. Read the fields; build one with new, which a caller only needs when it drives an encoder itself, in a test.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§source_id: i64

The source’s row id in the archive the rows are in. Unique only within that file: a copy renumbers it, so it names the source for the life of one handle on one file, not across files.

§source_uuid: Option<&'a str>

The source’s uuid (FORMAT.md §3.1), which a plain copy carries unchanged, or None for a source from before the uuid column. A copy of such a source, and a copy kept under a fresh uuid (rewrite::copy_sources_into_as_copies), mint a uuid for the destination that the encoder is not told.

§stream: &'a str

The stream whose rows these are.

Implementations§

Source§

impl<'a> EncodeContext<'a>

Source

pub fn new(source_id: i64, stream: &'a str) -> Self

A context for stream of source source_id, with no uuid.

Source

pub fn with_source_uuid(self, source_uuid: Option<&'a str>) -> Self

The same context, with the source’s uuid.

Trait Implementations§

Source§

impl<'a> Clone for EncodeContext<'a>

Source§

fn clone(&self) -> Self

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<'a> Copy for EncodeContext<'a>

Source§

impl<'a> Debug for EncodeContext<'a>

Source§

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

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

impl<'a> Eq for EncodeContext<'a>

Source§

impl<'a> PartialEq for EncodeContext<'a>

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl<'a> StructuralPartialEq for EncodeContext<'a>

Auto Trait Implementations§

§

impl<'a> Forget for EncodeContext<'a>

§

impl<'a> Freeze for EncodeContext<'a>

§

impl<'a> Move for EncodeContext<'a>

§

impl<'a> RefUnwindSafe for EncodeContext<'a>

§

impl<'a> Send for EncodeContext<'a>

§

impl<'a> Sync for EncodeContext<'a>

§

impl<'a> Unpin for EncodeContext<'a>

§

impl<'a> UnsafeUnpin for EncodeContext<'a>

§

impl<'a> UnwindSafe for EncodeContext<'a>

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more