pub enum Value {
Integer {
value: i64,
comment: Option<String>,
},
Float {
value: f64,
comment: Option<String>,
},
Logical {
value: bool,
comment: Option<String>,
},
String {
value: String,
comment: Option<String>,
},
Undefined,
Invalid(String),
}Expand description
The value a header card carries, with the comment written beside it.
FITS gives a card one of four kinds of value — an integer, a floating point
number, a logical T/F, or a quoted string — or no value at all. Build one
from the Rust type it corresponds to and hand it to Header::set_card:
let mut header = Header::default();
header.set_card("FILTER", "Halpha")?;
header.set_card("GAIN", Value::from(1.5).with_comment("e-/ADU"))?;Variants§
Integer
A whole number, written right-justified against column 30.
Fields
Float
A floating point number, written right-justified against column 30.
Fields
Logical
A logical, written as the single character T or F.
Fields
String
Text, written in single quotes with any quote inside it doubled.
Fields
Undefined
A keyword written with an empty value field, which the standard allows.
Invalid(String)
A value field this crate could not read, kept as the text it held so that nothing is lost.
Implementations§
Source§impl Value
impl Value
Sourcepub fn comment_to_string(&self) -> String
pub fn comment_to_string(&self) -> String
The comment beside this value, or an empty string where there is none.
Sourcepub fn value_to_string(&self) -> String
pub fn value_to_string(&self) -> String
This value as the text a card writes it as, without its quotes.
An undefined or unreadable value has no text, and comes back empty.
Source§impl Value
The comment on a value, replaced rather than merged.
impl Value
The comment on a value, replaced rather than merged.
Sourcepub fn with_comment(self, comment: impl Into<String>) -> Self
pub fn with_comment(self, comment: impl Into<String>) -> Self
This value carrying comment beside it.
A comment on an Value::Undefined or Value::Invalid value has
nowhere to live and is dropped: neither of them is written with a value
field for a comment to follow.
Trait Implementations§
Source§impl<T: Into<Value>> From<Option<T>> for Value
An absent value is an undefined one: the keyword is written with an empty
value field, which is how FITS spells “this card has no value”.
impl<T: Into<Value>> From<Option<T>> for Value
An absent value is an undefined one: the keyword is written with an empty value field, which is how FITS spells “this card has no value”.
impl StructuralPartialEq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin for Value
impl UnwindSafe for Value
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