Skip to main content

Value

Enum Value 

Source
pub enum Value {
Show 17 variants String(String), StringArray(Vec<String>), Boolean(Vec<bool>), Bit { bytes: Vec<u8>, len: usize, }, U8(Vec<u8>), I8(Vec<i8>), U16(Vec<u16>), I16(Vec<i16>), U32(Vec<u32>), I32(Vec<i32>), I64(Vec<i64>), U64(Vec<u64>), F32(Vec<f32>), F64(Vec<f64>), C32(Vec<(f32, f32)>), M64(Vec<(f64, f64)>), Null,
}
Expand description

One entry of one column of a table.

A FITS column holds a run of values rather than a single one, so every variant here carries a vector even where the run is one long.

Variants§

§

String(String)

rA: one string of r characters.

§

StringArray(Vec<String>)

rAw: r / w strings of w characters each.

§

Boolean(Vec<bool>)

rL: r logicals.

§

Bit

rX: r bits, packed into ceil(r / 8) bytes.

The bits stay packed because that is how the column stores them; len says how many of them are real, since the last byte is padded. Use Value::bits to walk them.

Fields

§bytes: Vec<u8>

The bytes the bits are packed into.

§len: usize

How many bits of them the column actually holds.

§

U8(Vec<u8>)

rB: r unsigned bytes.

§

I8(Vec<i8>)

rS: r signed bytes.

§

U16(Vec<u16>)

rU: r unsigned 16-bit integers.

§

I16(Vec<i16>)

rI: r signed 16-bit integers.

§

U32(Vec<u32>)

rV: r unsigned 32-bit integers.

§

I32(Vec<i32>)

rJ: r signed 32-bit integers.

§

I64(Vec<i64>)

rK: r signed 64-bit integers.

§

U64(Vec<u64>)

rK with a TZEROn of 2^63: the unsigned reading of a signed column.

§

F32(Vec<f32>)

rE: r single precision floats.

§

F64(Vec<f64>)

rD: r double precision floats.

§

C32(Vec<(f32, f32)>)

rC: single precision complex values, as (real, imaginary) pairs.

§

M64(Vec<(f64, f64)>)

rM: double precision complex values, as (real, imaginary) pairs.

§

Null

Every element of this entry is the TNULLn value, so the entry is undefined. Deserialising it into an Option<T> field yields None.

Implementations§

Source§

impl Value

Source

pub fn as_string(&self) -> Option<&String>

Returns some if the value is a string

Source

pub fn as_f64(&self) -> Option<&Vec<f64>>

The values if this is a double precision column, or None if it is not.

Source

pub fn as_f32(&self) -> Option<&Vec<f32>>

The values if this is a single precision column, or None if it is not.

Source

pub fn bits(&self) -> Option<impl Iterator<Item = bool> + '_>

The bits of an rX column, most significant first, or None for any other column.

The padding in the last byte is left out, so this yields exactly the r bits the column declares.

Source

pub fn is_null(&self) -> bool

Whether this entry is undefined, per its column’s TNULLn card.

Source

pub fn as_i64(&self) -> Option<i64>

The first value if this is a 64-bit integer column, or None if it is not.

Trait Implementations§

Source§

impl Clone for Value

Source§

fn clone(&self) -> Value

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Value

Source§

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

Formats the value using the given formatter. Read more

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> 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> 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 = !

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.