NoneFill

Enum NoneFill 

Source
pub enum NoneFill {
    RepChar(u8),
    String(Vec<u8>),
    PartialTyped {
        int: i64,
        real: f64,
        fill_byte: u8,
    },
    Typed {
        logical: bool,
        int: i64,
        real: f64,
        string: Vec<u8>,
    },
}
Expand description

A enum that describes how fill values are created or interpreted.

When serializing data, this is used to decide how to write None values, the unit type, and unit structs to the output. When deserializing, it is used to determine whether an Option value should be Some or None. (It is not needed for deseralizing unit types/structs.)

Variants§

§

RepChar(u8)

This variant will represent fill values with a single character repeated to fill the width of the field. This is the default, with an * as the character.

§

String(Vec<u8>)

This variant will represent fill values with a string. If the string is shorter than the field width, it is truncated.

§

PartialTyped

This variant takes an integer and float fill value, and will serialize those values for fills. Other field types will be filled as in the RepChar variant.

Fields

§int: i64
§real: f64
§fill_byte: u8
§

Typed

This variant takes a specific fill value for each possible Fortran type. The string/character fill will be truncated if it is longer than the field; the others may overflow and print as *s if the field is not wide enough.

Fields

§logical: bool
§int: i64
§real: f64
§string: Vec<u8>

Implementations§

Source§

impl NoneFill

Source

pub fn new_rep_char(c: char) -> Result<Self, TryFromCharError>

Create a new NoneFill::RepChar instance with c as the fill byte.

Note that c must be a character which can be written as one byte - usually this means it must be an ASCII character. If it is not, this function will return an error.

Source

pub fn new_string(s: &str) -> Self

Create a new NoneFill::String instance with s as the fill string.

Note that s is converted to bytes internally, and as with all Fortran character fields, it is the number of bytes that is compared against the field width when determining if the string must be truncated.

Using only ASCII characters is recommended.

Source

pub fn new_partial_typed(int: i64, real: f64) -> Self

Create a new NoneFill:PartialTyped instance with int as the integer fill and real as the real/float fill.

This will always use * as the fill byte for other field types. If you wish to use a different fill byte, construct this variant directly.

Source

pub fn new_typed(logical: bool, int: i64, real: f64, string: &str) -> Self

Create a new NoneFill:Typed instance with fill values for each of the four Fortran types.

Trait Implementations§

Source§

impl Clone for NoneFill

Source§

fn clone(&self) -> NoneFill

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NoneFill

Source§

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

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

impl Default for NoneFill

Source§

fn default() -> Self

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

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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.