pub struct TForm {
pub r: usize,
pub t: TFormType,
pub a: String,
}Available on crate feature
fits only.Expand description
A value corresponding to the TFORM keyword.
Fields§
§r: usizeThe repeat count
t: TFormTypeThe field type
a: StringUndefined additional characters
Implementations§
Trait Implementations§
Source§impl FitsHeaderValue for TForm
use astro_rs::fits::*;
// successful deserialization
let double_value: TForm = FitsHeaderValue::from_bytes(b"'1D '".to_vec())?;
assert_eq!(double_value.value(), 8);
let repeat_int_value: TForm = FitsHeaderValue::from_bytes(b"'2I '".to_vec())?;
assert_eq!(repeat_int_value.value(), 4);
let comment_char_value: TForm = FitsHeaderValue::from_bytes(b"'1A comment'".to_vec())?;
assert_eq!(comment_char_value.value(), 1);
let short_complex_value: TForm = FitsHeaderValue::from_bytes(b"'M '".to_vec())?;
assert_eq!(short_complex_value.value(), 16);
// failed deserialization
let result: Result<TForm, FitsHeaderError> = FitsHeaderValue::from_bytes(b"U".to_vec());
assert!(result.is_err());
let result: Result<TForm, FitsHeaderError> = FitsHeaderValue::from_bytes(b"nonsense".to_vec());
assert!(result.is_err());
// serialization
assert_eq!(double_value.to_bytes(), *b"'1D ' ");
assert_eq!(repeat_int_value.to_bytes(), *b"'2I ' ");
assert_eq!(comment_char_value.to_bytes(), *b"'1A comment' ");
assert_eq!(short_complex_value.to_bytes(), *b"'1M ' ");
impl FitsHeaderValue for TForm
use astro_rs::fits::*;
// successful deserialization
let double_value: TForm = FitsHeaderValue::from_bytes(b"'1D '".to_vec())?;
assert_eq!(double_value.value(), 8);
let repeat_int_value: TForm = FitsHeaderValue::from_bytes(b"'2I '".to_vec())?;
assert_eq!(repeat_int_value.value(), 4);
let comment_char_value: TForm = FitsHeaderValue::from_bytes(b"'1A comment'".to_vec())?;
assert_eq!(comment_char_value.value(), 1);
let short_complex_value: TForm = FitsHeaderValue::from_bytes(b"'M '".to_vec())?;
assert_eq!(short_complex_value.value(), 16);
// failed deserialization
let result: Result<TForm, FitsHeaderError> = FitsHeaderValue::from_bytes(b"U".to_vec());
assert!(result.is_err());
let result: Result<TForm, FitsHeaderError> = FitsHeaderValue::from_bytes(b"nonsense".to_vec());
assert!(result.is_err());
// serialization
assert_eq!(double_value.to_bytes(), *b"'1D ' ");
assert_eq!(repeat_int_value.to_bytes(), *b"'2I ' ");
assert_eq!(comment_char_value.to_bytes(), *b"'1A comment' ");
assert_eq!(short_complex_value.to_bytes(), *b"'1M ' ");Auto Trait Implementations§
impl Freeze for TForm
impl RefUnwindSafe for TForm
impl Send for TForm
impl Sync for TForm
impl Unpin for TForm
impl UnwindSafe for TForm
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
Mutably borrows from an owned value. Read more
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> RealAny for Twhere
T: Any,
impl<T> RealAny for Twhere
T: Any,
Source§fn real_type_id(&self) -> TypeId
fn real_type_id(&self) -> TypeId
Available on crate feature
fits only.Gets the base type ID for
self.