pub struct FixedSchema { /* private fields */ }Expand description
Representation of the schema for a fixed-length file (.flf), containing the only allowed fields.
Implementations§
Source§impl FixedSchema
impl FixedSchema
Sourcepub fn new(name: String, version: usize, columns: Vec<FixedColumn>) -> Self
pub fn new(name: String, version: usize, columns: Vec<FixedColumn>) -> Self
Create a new FixedSchema from the provided field values.
Sourcepub fn from_path(path: PathBuf) -> Result<Self>
pub fn from_path(path: PathBuf) -> Result<Self>
Create a new FixedSchema by reading a .json file at the provided path.
§Errors
This function will return an error under a number of different circumstances. These error conditions are listed below.
NotFound: The specified file does not exist and neithercreateorcreate_newis set.NotFound: One of the directory components of the file path does not exist.PermissionDenied: The user lacks permission to get the specified access rights for the file.PermissionDenied: The user lacks permission to open one of the directory components of the specified path.AlreadyExists:create_newwas specified and the file already exists.InvalidInput: Invalid combinations of open options (truncate without write access, no access mode set, etc.).
§Examples
use evolution_schema::schema::FixedSchema;
use std::path::PathBuf;
let path: PathBuf = PathBuf::from(r"/path/to/my/schema.json");
let schema: FixedSchema = FixedSchema::from_path(path).unwrap();
println!("This is my cool schema: {:?}", schema);Sourcepub fn columns(&self) -> &Vec<FixedColumn>
pub fn columns(&self) -> &Vec<FixedColumn>
Get the columns of the schema.
Sourcepub fn num_columns(&self) -> usize
pub fn num_columns(&self) -> usize
Get the number of columns in the schema.
Sourcepub fn row_length(&self) -> usize
pub fn row_length(&self) -> usize
Get the total length of a fixed-length row.
Sourcepub fn column_names(&self) -> Vec<&String>
pub fn column_names(&self) -> Vec<&String>
Get the names of the columns.
Sourcepub fn column_offsets(&self) -> Vec<usize>
pub fn column_offsets(&self) -> Vec<usize>
Get the offset indices for each column (in number of runes).
Sourcepub fn column_lengths(&self) -> Vec<usize>
pub fn column_lengths(&self) -> Vec<usize>
Get the lengths of each column (in number of runes).
Sourcepub fn nullable_columns(&self) -> Vec<&FixedColumn>
pub fn nullable_columns(&self) -> Vec<&FixedColumn>
Get the columns that are nullable.
Sourcepub fn not_nullable_columns(&self) -> Vec<&FixedColumn>
pub fn not_nullable_columns(&self) -> Vec<&FixedColumn>
Get the columns that are not nullable.
Sourcepub fn iter(&self) -> FixedSchemaIterator<'_> ⓘ
pub fn iter(&self) -> FixedSchemaIterator<'_> ⓘ
Borrow the vector of FixedColumns and create a new iterator with it.
Sourcepub fn into_arrow_schema(self) -> ArrowSchema
pub fn into_arrow_schema(self) -> ArrowSchema
Consume the FixedSchema and produce an ArrowSchema from it.
Sourcepub fn into_builder<T>(self) -> Twhere
T: Builder,
pub fn into_builder<T>(self) -> Twhere
T: Builder,
Consume the FixedSchema and produce an instance of a Builder from it.
Trait Implementations§
Source§impl Clone for FixedSchema
impl Clone for FixedSchema
Source§fn clone(&self) -> FixedSchema
fn clone(&self) -> FixedSchema
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FixedSchema
impl Debug for FixedSchema
Source§impl Default for FixedSchema
impl Default for FixedSchema
Source§fn default() -> FixedSchema
fn default() -> FixedSchema
Source§impl<'de> Deserialize<'de> for FixedSchema
impl<'de> Deserialize<'de> for FixedSchema
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for FixedSchema
impl Serialize for FixedSchema
impl Schema for FixedSchema
Auto Trait Implementations§
impl Freeze for FixedSchema
impl RefUnwindSafe for FixedSchema
impl Send for FixedSchema
impl Sync for FixedSchema
impl Unpin for FixedSchema
impl UnwindSafe for FixedSchema
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more