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.
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.
Implementations§
Source§impl NoneFill
impl NoneFill
Sourcepub fn new_rep_char(c: char) -> Result<Self, TryFromCharError>
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.
Sourcepub fn new_string(s: &str) -> Self
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.
Sourcepub fn new_partial_typed(int: i64, real: f64) -> Self
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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NoneFill
impl RefUnwindSafe for NoneFill
impl Send for NoneFill
impl Sync for NoneFill
impl Unpin for NoneFill
impl UnwindSafe for NoneFill
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> 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