Struct surrealml_core::storage::header::Header

source ·
pub struct Header {
    pub keys: KeyBindings,
    pub normalisers: NormaliserMap,
    pub output: Output,
    pub name: StringValue,
    pub version: Version,
    pub description: StringValue,
    pub engine: Engine,
    pub origin: Origin,
    pub input_dims: InputDims,
}
Expand description

The header of the model file.

§Fields

  • keys - The key bindings where the order of the input columns is stored.
  • normalisers - The normalisers where the normalisation functions are stored per column if there are any.
  • output - The output where the output column name and normaliser are stored if there are any.
  • name - The name of the model.
  • version - The version of the model.
  • description - The description of the model.
  • engine - The engine of the model (could be native or pytorch).
  • origin - The origin of the model which is where the model was created and who the author is.

Fields§

§keys: KeyBindings§normalisers: NormaliserMap§output: Output§name: StringValue§version: Version§description: StringValue§engine: Engine§origin: Origin§input_dims: InputDims

Implementations§

source§

impl Header

source

pub fn fresh() -> Self

Creates a new header with no columns or normalisers.

§Returns

A new header with no columns or normalisers.

source

pub fn add_name(&mut self, model_name: String)

Adds a model name to the self.name field.

§Arguments
  • model_name - The name of the model to be added.
source

pub fn add_version(&mut self, version: String) -> Result<(), SurrealError>

Adds a version to the self.version field.

§Arguments
  • version - The version to be added.
source

pub fn add_description(&mut self, description: String)

Adds a description to the self.description field.

§Arguments
  • description - The description to be added.
source

pub fn add_column(&mut self, column_name: String)

Adds a column name to the self.keys field. It must be noted that the order in which the columns are added is the order in which they will be expected in the input data. We can do this with the followng example:

§Arguments
  • column_name - The name of the column to be added.
source

pub fn add_normaliser( &mut self, column_name: String, normaliser: NormaliserType ) -> Result<(), SurrealError>

Adds a normaliser to the self.normalisers field.

§Arguments
  • column_name - The name of the column to which the normaliser will be applied.
  • normaliser - The normaliser to be applied to the column.
source

pub fn get_normaliser( &self, column_name: &String ) -> Result<Option<&NormaliserType>, SurrealError>

Gets the normaliser for a given column name.

§Arguments
  • column_name - The name of the column to which the normaliser will be applied.
§Returns

The normaliser for the given column name.

source

pub fn add_output( &mut self, column_name: String, normaliser: Option<NormaliserType> )

Adds an output column to the self.output field.

§Arguments
  • column_name - The name of the column to be added.
  • normaliser - The normaliser to be applied to the column.
source

pub fn add_engine(&mut self, engine: String)

Adds an engine to the self.engine field.

§Arguments
  • engine - The engine to be added.
source

pub fn add_author(&mut self, author: String)

Adds an author to the self.origin field.

§Arguments
  • author - The author to be added.
source

pub fn add_origin(&mut self, origin: String) -> Result<(), SurrealError>

Adds an origin to the self.origin field.

§Arguments
  • origin - The origin to be added.
source

pub fn from_bytes(data: Vec<u8>) -> Result<Self, SurrealError>

Constructs the Header struct from bytes.

§Arguments
  • data - The bytes to be converted into a Header struct.
§Returns

The Header struct.

source

pub fn to_bytes(&self) -> (i32, Vec<u8>)

Converts the Header struct into bytes.

§Returns

A tuple containing the number of bytes in the header and the bytes themselves.

Trait Implementations§

source§

impl Debug for Header

source§

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

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

impl PartialEq for Header

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Header

Auto Trait Implementations§

§

impl Freeze for Header

§

impl RefUnwindSafe for Header

§

impl Send for Header

§

impl Sync for Header

§

impl Unpin for Header

§

impl UnwindSafe for Header

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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

§

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