SSDVPacketArray

Struct SSDVPacketArray 

Source
#[repr(transparent)]
pub struct SSDVPacketArray<P: SSDVParameters>(pub GenericArray<u8, P::PacketLen>);
Expand description

SSDV packet stored in a GenericArray.

This struct stores an SSDV packet in a GenericArray transparently (so the packet has the same ABI as an array [u8; N]). The struct implements the SSDVPacket trait by using the parameters defined in the SSDVParameters implementation of the type parameter P.

Tuple Fields§

§0: GenericArray<u8, P::PacketLen>

Implementations§

Source§

impl<P: SSDVParameters> SSDVPacketArray<P>

Source

pub fn new_from_slice(slice: &[u8]) -> Result<Self, LengthError>

Creates a new SSDV packet from a slice.

This function creates a new SSDV packet by copying the data in slice. If the length of slice is different from the SSDV packet length specified by P::PacketLen, an error is returned.

Trait Implementations§

Source§

impl<P: SSDVParameters> Clone for SSDVPacketArray<P>

Source§

fn clone(&self) -> Self

Returns a duplicate 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<P: SSDVParameters> Debug for SSDVPacketArray<P>

Source§

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

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

impl<P: SSDVParameters> Default for SSDVPacketArray<P>

Source§

fn default() -> Self

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

impl<P: SSDVParameters> From<GenericArray<u8, <P as SSDVParameters>::PacketLen>> for SSDVPacketArray<P>

Source§

fn from(value: GenericArray<u8, P::PacketLen>) -> Self

Converts to this type from the input type.
Source§

impl<P: SSDVParameters> From<SSDVPacketArray<P>> for GenericArray<u8, P::PacketLen>

Source§

fn from(value: SSDVPacketArray<P>) -> Self

Converts to this type from the input type.
Source§

impl<P: SSDVParameters> Hash for SSDVPacketArray<P>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<P: SSDVParameters> PartialEq for SSDVPacketArray<P>

Source§

fn eq(&self, other: &Self) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<P: SSDVParameters> SSDVPacket for SSDVPacketArray<P>

Source§

type DataLen = <P as SSDVParameters>::DataLen

Length of the data field of an SSDV packet. Read more
Source§

type CrcDataLen = <P as SSDVParameters>::CrcDataLen

Length of the data taken into account for CRC-32 calculation. Read more
Source§

type CallsignLen = <P as SSDVParameters>::CallsignLen

Length of the callsign field. Read more
Source§

fn set_fixed_fields(&mut self)

Sets the fields of the packet that have fixed values. Read more
Source§

fn callsign(&self) -> &GenericArray<u8, Self::CallsignLen>

Returns a reference to an array containing the callsign field.
Source§

fn callsign_as_mut(&mut self) -> &mut GenericArray<u8, Self::CallsignLen>

Returns a mutable reference to an array containing the callsign field.
Source§

fn image_id(&self) -> u8

Returns the value of the image ID field.
Source§

fn set_image_id(&mut self, image_id: u8)

Sets the value of the image ID field.
Source§

fn packet_id(&self) -> u16

Returns the value of the packet ID field.
Source§

fn set_packet_id(&mut self, packet_id: u16)

Sets the value of the packet ID field.
Source§

fn width(&self) -> Option<u8>

Returns the value of the width field. Read more
Source§

fn set_width(&mut self, width: u8)

Sets the value of the width field. Read more
Source§

fn height(&self) -> Option<u8>

Returns the value of the height field. Read more
Source§

fn set_height(&mut self, height: u8)

Sets the value of the height field. Read more
Source§

fn number_systematic_packets(&self) -> Option<u16>

Returns the value of the number of systematic packets field. Read more
Source§

fn set_number_systematic_packets(&mut self, number_systematic_packets: u16)

Sets the value of the number of systematic packets field. Read more
Source§

fn flags(&self) -> u8

Returns the value of the flags field.
Source§

fn set_flags(&mut self, flags: u8)

Sets the value of the flags field.
Source§

fn data(&self) -> &GenericArray<u8, Self::DataLen>

Returns a reference to an array containing the packet data field. Read more
Source§

fn data_as_mut(&mut self) -> &mut GenericArray<u8, Self::DataLen>

Returns a mutable reference to an array containing the packet data field. Read more
Source§

fn crc32_data(&self) -> &GenericArray<u8, Self::CrcDataLen>

Returns a reference to an array containing the part of the packet covered by the CRC-32 calculation.
Source§

fn compute_crc32<I, T>(data: I) -> u32
where I: Iterator<Item = T>, T: Borrow<u8>,

Computes the CRC-32 of some data with the CRC-32 algorithm used by this SSDV packet format. Read more
Source§

fn crc32(&self) -> u32

Returns the value of the CRC-32 field of the packet.
Source§

fn set_crc32(&mut self, crc32: u32)

Sets the value of the CRC-32 field of the packet.
Source§

fn is_eoi(&self) -> bool

Returns true if the packet has the EOI flag set.
Source§

fn set_eoi(&mut self, eoi: bool)

Sets the value of the EOI flag.
Source§

fn is_fec_packet(&self) -> bool

Returns true if the packet has the FEC packet flag set.
Source§

fn set_fec_packet(&mut self, fec_packet: bool)

Sets the value of the FEC packet flag.
Source§

fn computed_crc32(&self) -> u32

Calculates the CRC-32 of the data in the packet. Read more
Source§

fn crc32_is_valid(&self) -> bool

Returns true if the CRC-32 of the packet is correct.
Source§

fn update_crc32(&mut self)

Sets the CRC-32 field of the packet to the CRC computed from the data. Read more
Source§

impl<P: SSDVParameters> Copy for SSDVPacketArray<P>

Source§

impl<P: SSDVParameters> Eq for SSDVPacketArray<P>

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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 = 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>,

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.