pub struct DataSet<T: DataSetT, const ENTRIES: usize> {
    pub metadata: Metadata,
    pub lut: LookUpTable<ENTRIES>,
    pub data_checksum: u32,
    pub bytes: Bytes,
    /* private fields */
}
Expand description

A DataSet is the core structure shared by all ANISE binary data.

Fields§

§metadata: Metadata§lut: LookUpTable<ENTRIES>

All datasets have LookUpTable (LUT) that stores the mapping between a key and its index in the ephemeris list.

§data_checksum: u32§bytes: Bytes

The actual data from the dataset

Implementations§

source§

impl DataSet<PlanetaryData, MAX_PLANETARY_DATA>

source

pub fn describe(&self) -> String

Returns a table describing this planetary data set

source§

impl<T: DataSetT, const ENTRIES: usize> DataSet<T, ENTRIES>

source

pub fn try_from_bytes<B: Deref<Target = [u8]>>( bytes: B ) -> Result<Self, DataSetError>

Try to load an Anise file from a pointer of bytes

source

pub fn from_bytes<B: Deref<Target = [u8]>>(buf: B) -> Self

Forces to load an Anise file from a pointer of bytes. Panics if the bytes cannot be interpreted as an Anise file.

source

pub fn crc32(&self) -> u32

Compute the CRC32 of the underlying bytes

source

pub fn set_crc32(&mut self)

Sets the checksum of this data.

source

pub fn check_integrity(&self) -> Result<(), IntegrityError>

source

pub fn scrub(&self) -> Result<(), IntegrityError>

Scrubs the data by computing the CRC32 of the bytes and making sure that it still matches the previously known hash

source

pub fn get_by_id(&self, id: i32) -> Result<T, DataSetError>

source

pub fn get_by_name(&self, name: &str) -> Result<T, DataSetError>

source

pub fn save_as( &self, filename: &PathBuf, overwrite: bool ) -> Result<(), DataSetError>

Saves this dataset to the provided file If overwrite is set to false, and the filename already exists, this function will return an error.

source

pub fn len(&self) -> usize

Returns the length of the LONGEST of the two look up tables

source

pub fn is_empty(&self) -> bool

Returns whether this dataset is empty

Trait Implementations§

source§

impl<T: Clone + DataSetT, const ENTRIES: usize> Clone for DataSet<T, ENTRIES>

source§

fn clone(&self) -> DataSet<T, ENTRIES>

Returns a copy 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<T: Debug + DataSetT, const ENTRIES: usize> Debug for DataSet<T, ENTRIES>

source§

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

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

impl<'a, T: DataSetT, const ENTRIES: usize> Decode<'a> for DataSet<T, ENTRIES>

source§

fn decode<D: Reader<'a>>(decoder: &mut D) -> Result<Self>

Attempt to decode this message using the provided decoder.
source§

fn from_der(bytes: &'a [u8]) -> Result<Self, Error>

Parse Self from the provided DER-encoded byte slice.
source§

impl<T: Default + DataSetT, const ENTRIES: usize> Default for DataSet<T, ENTRIES>

source§

fn default() -> DataSet<T, ENTRIES>

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

impl<T: DataSetT, const ENTRIES: usize> Display for DataSet<T, ENTRIES>

source§

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

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

impl<T: DataSetT, const ENTRIES: usize> Encode for DataSet<T, ENTRIES>

source§

fn encoded_len(&self) -> Result<Length>

Compute the length of this value in bytes when encoded as ASN.1 DER.
source§

fn encode(&self, encoder: &mut impl Writer) -> Result<()>

Encode this value as ASN.1 DER using the provided Writer.
source§

fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>

Encode this value to the provided byte slice, returning a sub-slice containing the encoded message.
source§

fn encode_to_vec(&self, buf: &mut Vec<u8>) -> Result<Length, Error>

Encode this message as ASN.1 DER, appending it to the provided byte vector.
source§

fn to_der(&self) -> Result<Vec<u8>, Error>

Encode this type as DER, returning a byte vector.
source§

impl<T: PartialEq + DataSetT, const ENTRIES: usize> PartialEq for DataSet<T, ENTRIES>

source§

fn eq(&self, other: &DataSet<T, ENTRIES>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T: Eq + DataSetT, const ENTRIES: usize> Eq for DataSet<T, ENTRIES>

source§

impl<T: DataSetT, const ENTRIES: usize> StructuralPartialEq for DataSet<T, ENTRIES>

Auto Trait Implementations§

§

impl<T, const ENTRIES: usize> !Freeze for DataSet<T, ENTRIES>

§

impl<T, const ENTRIES: usize> RefUnwindSafe for DataSet<T, ENTRIES>
where T: for<'a> Decode<'a> + Encode + RefUnwindSafe,

§

impl<T, const ENTRIES: usize> Send for DataSet<T, ENTRIES>
where T: for<'a> Decode<'a> + Encode + Send,

§

impl<T, const ENTRIES: usize> Sync for DataSet<T, ENTRIES>
where T: for<'a> Decode<'a> + Encode + Sync,

§

impl<T, const ENTRIES: usize> Unpin for DataSet<T, ENTRIES>
where T: for<'a> Decode<'a> + Encode + Unpin,

§

impl<T, const ENTRIES: usize> UnwindSafe for DataSet<T, ENTRIES>
where T: for<'a> Decode<'a> + Encode + UnwindSafe,

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Same for T

§

type Output = T

Should always be Self
source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
source§

impl<T> ToOwned for T
where T: Clone,

§

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> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> DecodeOwned for T
where T: for<'a> Decode<'a>,

source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,