Skip to main content

TokenBlockMmInfo

Struct TokenBlockMmInfo 

Source
pub struct TokenBlockMmInfo {
    pub mm_hash: u64,
    pub offset: usize,
    pub length: usize,
}
Expand description

Metadata describing a single multimodal placeholder run within a token sequence.

A run occupies length consecutive slots starting at offset. The token IDs at those slot positions are opaque for hashing — the (mm_hash, run_offset) pair drives the per-slot bytes during block formation.

See compute_block_bytes_with_mm for the byte-encoding rule.

Fields§

§mm_hash: u64

Hash identifying the multimodal object (image / audio / etc.).

§offset: usize

Start position of the placeholder run in the full token sequence (zero-based).

§length: usize

Number of placeholder slots in the run.

Implementations§

Source§

impl TokenBlockMmInfo

Source

pub fn checked_end(&self) -> Option<usize>

Returns the exclusive end position of this run, or None on usize overflow.

Source

pub fn end(&self) -> usize

Returns the exclusive end position of this run.

§Panics

Panics if offset + length overflows usize. Prefer Self::checked_end in validation paths; this helper is for already-validated runs.

Source

pub fn covers(&self, position: usize) -> bool

Returns true if the given absolute position falls inside this run. Returns false if the run’s end overflows usize (such a run is invalid; use validate_and_sort_mm_info before relying on this method).

Trait Implementations§

Source§

impl Clone for TokenBlockMmInfo

Source§

fn clone(&self) -> TokenBlockMmInfo

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 Copy for TokenBlockMmInfo

Source§

impl Debug for TokenBlockMmInfo

Source§

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

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

impl<'de> Deserialize<'de> for TokenBlockMmInfo

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<TokenBlockMmInfo, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Eq for TokenBlockMmInfo

Source§

impl From<RequestMmObjectInfo> for TokenBlockMmInfo

Source§

fn from(v: RequestMmObjectInfo) -> Self

Converts to this type from the input type.
Source§

impl From<TokenBlockMmInfo> for RequestMmObjectInfo

Source§

fn from(v: TokenBlockMmInfo) -> Self

Converts to this type from the input type.
Source§

impl Hash for TokenBlockMmInfo

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 PartialEq for TokenBlockMmInfo

Source§

fn eq(&self, other: &TokenBlockMmInfo) -> 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.
Source§

impl Serialize for TokenBlockMmInfo

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for TokenBlockMmInfo

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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