Skip to main content

AprV2Flags

Struct AprV2Flags 

Source
pub struct AprV2Flags(/* private fields */);
Expand description

APR v2 feature flags (16-bit for expanded feature set)

Implementations§

Source§

impl AprV2Flags

Source

pub const LZ4_COMPRESSED: u16 = 0b0000_0000_0000_0001

Payload is compressed with LZ4

Source

pub const ZSTD_COMPRESSED: u16 = 0b0000_0000_0000_0010

Payload is compressed with Zstd

Source

pub const ENCRYPTED: u16 = 0b0000_0000_0000_0100

Payload is encrypted (AES-256-GCM)

Source

pub const SIGNED: u16 = 0b0000_0000_0000_1000

Has digital signature (Ed25519)

Source

pub const SHARDED: u16 = 0b0000_0000_0001_0000

Model is sharded across multiple files

Source

pub const QUANTIZED: u16 = 0b0000_0000_0010_0000

Tensors are quantized

Source

pub const HAS_FILTERBANK: u16 = 0b0000_0000_0100_0000

Has embedded filterbank (for Whisper models)

Source

pub const HAS_MODEL_CARD: u16 = 0b0000_0000_1000_0000

Has model card metadata

Source

pub const STREAMING: u16 = 0b0000_0001_0000_0000

Supports streaming/chunked loading

Source

pub const HAS_VOCAB: u16 = 0b0000_0010_0000_0000

Contains vocabulary/tokenizer

Source

pub const LAYOUT_ROW_MAJOR: u16 = 0b0000_0100_0000_0000

LAYOUT-002: Tensor layout is row-major (REQUIRED for valid APR files) All APR files created after LAYOUT-002 must have this flag set. Pre-LAYOUT-002 files without this flag are assumed row-major.

Source

pub const LAYOUT_COLUMN_MAJOR: u16 = 0b0000_1000_0000_0000

LAYOUT-002: Tensor layout is column-major (FORBIDDEN - Jidoka guard) If this flag is set, the APR file is “dirty” and must be rejected. This flag exists to catch improperly converted GGUF files.

Source

pub const fn new() -> Self

Create new empty flags

Source

pub const fn from_bits(bits: u16) -> Self

Create from raw u16 value

Source

pub const fn bits(self) -> u16

Get raw bits

Source

pub const fn contains(self, flag: u16) -> bool

Check if flag is set

Source

pub const fn with(self, flag: u16) -> Self

Set a flag

Source

pub const fn without(self, flag: u16) -> Self

Clear a flag

Source

pub const fn is_lz4_compressed(self) -> bool

Check if LZ4 compressed

Source

pub const fn is_zstd_compressed(self) -> bool

Check if Zstd compressed

Source

pub const fn is_encrypted(self) -> bool

Check if encrypted

Source

pub const fn is_sharded(self) -> bool

Check if sharded

Source

pub const fn is_quantized(self) -> bool

Check if quantized

Source

pub const fn is_row_major(self) -> bool

LAYOUT-002: Check if row-major layout flag is set

Source

pub const fn is_column_major(self) -> bool

LAYOUT-002: Check if column-major layout flag is set (should be rejected)

Source

pub const fn is_layout_valid(self) -> bool

LAYOUT-002: Validate layout is safe for inference Returns true if the file is row-major or pre-LAYOUT-002 (assumed row-major) Returns false if explicitly marked as column-major (dirty APR file)

Trait Implementations§

Source§

impl Clone for AprV2Flags

Source§

fn clone(&self) -> AprV2Flags

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 AprV2Flags

Source§

impl Debug for AprV2Flags

Source§

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

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

impl Default for AprV2Flags

Source§

fn default() -> AprV2Flags

Returns the “default value” for a type. Read more
Source§

impl Eq for AprV2Flags

Source§

impl PartialEq for AprV2Flags

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for AprV2Flags

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