pub enum GenericImage<'a> {
Ref(GenericImageRef<'a>),
Own(GenericImageOwned),
}Expand description
A serializable, generic image with metadata, backed by either
a GenericImageRef or a GenericImageOwned.
Variants§
Implementations§
source§impl GenericImage<'_>
impl GenericImage<'_>
sourcepub fn get_timestamp(&self) -> SystemTime
pub fn get_timestamp(&self) -> SystemTime
Get the timestamp of the image.
sourcepub fn get_exposure(&self) -> Option<Duration>
pub fn get_exposure(&self) -> Option<Duration>
Get the exposure time of the image.
sourcepub fn insert_key<T>(
&mut self,
name: &str,
value: T,
) -> Result<(), &'static str>where
T: InsertValue,
pub fn insert_key<T>(
&mut self,
name: &str,
value: T,
) -> Result<(), &'static str>where
T: InsertValue,
Insert a metadata value into the GenericImage.
§Arguments
name: The name of the metadata value. The name must be non-empty and less than 80 characters.value: The value to insert. The value is either a primitive type, aString, or astd::time::Durationorstd::time::SystemTimeor a tuple of a primitive type and a comment ().
§Valid Types
The valid types for the metadata value are:
u8|u16|u32|u64i8|i16|i32|i64f32|f64ColorSpacestd::time::Duration|std::time::SystemTimeString|&str
§Note
- The metadata key is case-insensitive and is stored as an uppercase string.
- Re-inserting a timestamp key will return an error.
- When saving to a FITS file, the metadata comment may be truncated.
- Metadata of type
std::time::Durationorstd::time::SystemTimeis split and stored as two consecutive metadata items, with the same key, split into seconds (u64) and nanoseconds (u64).
sourcepub fn remove_key(&mut self, name: &str) -> Result<(), &'static str>
pub fn remove_key(&mut self, name: &str) -> Result<(), &'static str>
Remove a metadata value from the GenericImageOwned.
§Arguments
name: The name of the metadata value to remove.
§Returns
Ok(())if the key was removed successfully.Err("Can not remove timestamp key")if the key is the timestamp key.Err("Key not found")if the key was not found.Err("Key cannot be empty")if the key is an empty string.Err("Key cannot be longer than 80 characters")if the key is longer than 80 characters.
sourcepub fn replace_key<T>(
&mut self,
name: &str,
value: T,
) -> Result<(), &'static str>where
T: InsertValue,
pub fn replace_key<T>(
&mut self,
name: &str,
value: T,
) -> Result<(), &'static str>where
T: InsertValue,
Replace a metadata value in the GenericImageOwned.
§Arguments
name: The name of the metadata value to replace.value: The new value to insert. The value is either a primitive type, aString, or astd::time::Durationorstd::time::SystemTimeor a tuple of a value type and a comment.
§Returns
Ok(())if the key was replaced successfully.Err("Key not found")if the key was not found.
sourcepub fn get_metadata(&self) -> &HashMap<String, GenericLineItem>
pub fn get_metadata(&self) -> &HashMap<String, GenericLineItem>
Get the contained metadata as a slice of GenericLineItems.
§Returns
A slice of GenericLineItems containing the metadata.
source§impl GenericImage<'_>
impl GenericImage<'_>
sourcepub fn as_raw_u8(&self) -> &[u8] ⓘ
pub fn as_raw_u8(&self) -> &[u8] ⓘ
Get the data as a slice of u8, regardless of the underlying type.
sourcepub fn as_raw_u8_checked(&self) -> Option<&[u8]>
pub fn as_raw_u8_checked(&self) -> Option<&[u8]>
Get the data as a slice of u8, regardless of the underlying type.
sourcepub fn as_slice_u8(&self) -> Option<&[u8]>
pub fn as_slice_u8(&self) -> Option<&[u8]>
Get the data as a slice of u8.
sourcepub fn as_mut_slice_u8(&mut self) -> Option<&mut [u8]>
pub fn as_mut_slice_u8(&mut self) -> Option<&mut [u8]>
Get the data as a mutable slice of u8.
sourcepub fn as_slice_u16(&self) -> Option<&[u16]>
pub fn as_slice_u16(&self) -> Option<&[u16]>
Get the data as a slice of u16.
sourcepub fn as_mut_slice_u16(&mut self) -> Option<&mut [u16]>
pub fn as_mut_slice_u16(&mut self) -> Option<&mut [u16]>
Get the data as a mutable slice of u16.
sourcepub fn as_slice_f32(&self) -> Option<&[f32]>
pub fn as_slice_f32(&self) -> Option<&[f32]>
Get the data as a slice of f32.
sourcepub fn as_mut_slice_f32(&mut self) -> Option<&mut [f32]>
pub fn as_mut_slice_f32(&mut self) -> Option<&mut [f32]>
Get the data as a mutable slice of f32.
Trait Implementations§
source§impl CalcOptExp for GenericImage<'_>
impl CalcOptExp for GenericImage<'_>
source§impl Clone for GenericImage<'_>
impl Clone for GenericImage<'_>
source§fn clone(&self) -> GenericImage<'_>
fn clone(&self) -> GenericImage<'_>
1.6.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<'a, 'b> Debayer<'a, 'b> for GenericImage<'b>where
'a: 'b,
impl<'a, 'b> Debayer<'a, 'b> for GenericImage<'b>where
'a: 'b,
source§type Output = GenericImage<'a>
type Output = GenericImage<'a>
source§fn debayer(
&'b self,
method: DemosaicMethod,
) -> Result<<GenericImage<'b> as Debayer<'a, 'b>>::Output, BayerError>
fn debayer( &'b self, method: DemosaicMethod, ) -> Result<<GenericImage<'b> as Debayer<'a, 'b>>::Output, BayerError>
source§impl<'a> Debug for GenericImage<'a>
impl<'a> Debug for GenericImage<'a>
source§impl From<GenericImageOwned> for GenericImage<'_>
impl From<GenericImageOwned> for GenericImage<'_>
source§fn from(img: GenericImageOwned) -> GenericImage<'_>
fn from(img: GenericImageOwned) -> GenericImage<'_>
source§impl<'a> From<GenericImageRef<'a>> for GenericImage<'a>
impl<'a> From<GenericImageRef<'a>> for GenericImage<'a>
source§fn from(img: GenericImageRef<'a>) -> GenericImage<'a>
fn from(img: GenericImageRef<'a>) -> GenericImage<'a>
source§impl ImageProps for GenericImage<'_>
impl ImageProps for GenericImage<'_>
source§type OutputU8 = GenericImageOwned
type OutputU8 = GenericImageOwned
ImageProps::cast_u8.source§fn color_space(&self) -> ColorSpace
fn color_space(&self) -> ColorSpace
source§fn pixel_type(&self) -> PixelType
fn pixel_type(&self) -> PixelType
source§fn cast_u8(&self) -> <GenericImage<'_> as ImageProps>::OutputU8
fn cast_u8(&self) -> <GenericImage<'_> as ImageProps>::OutputU8
u8 image. Read moresource§impl<'a> PartialEq for GenericImage<'a>
impl<'a> PartialEq for GenericImage<'a>
source§impl<'a> Serialize for GenericImage<'a>
impl<'a> Serialize for GenericImage<'a>
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
source§impl<'a, 'b> ToLuma<'a, 'b> for GenericImage<'b>where
'a: 'b,
impl<'a, 'b> ToLuma<'a, 'b> for GenericImage<'b>where
'a: 'b,
source§type Output = GenericImageOwned
type Output = GenericImageOwned
source§fn to_luma(
&'b self,
) -> Result<<GenericImage<'b> as ToLuma<'a, 'b>>::Output, &'static str>
fn to_luma( &'b self, ) -> Result<<GenericImage<'b> as ToLuma<'a, 'b>>::Output, &'static str>
source§fn to_luma_alpha(
&'b self,
) -> Result<<GenericImage<'b> as ToLuma<'a, 'b>>::Output, &'static str>
fn to_luma_alpha( &'b self, ) -> Result<<GenericImage<'b> as ToLuma<'a, 'b>>::Output, &'static str>
source§impl<'a> TryInto<GenericImageRef<'a>> for GenericImage<'a>
impl<'a> TryInto<GenericImageRef<'a>> for GenericImage<'a>
source§fn try_into(
self,
) -> Result<GenericImageRef<'a>, <GenericImage<'a> as TryInto<GenericImageRef<'a>>>::Error>
fn try_into( self, ) -> Result<GenericImageRef<'a>, <GenericImage<'a> as TryInto<GenericImageRef<'a>>>::Error>
impl<'a> StructuralPartialEq for GenericImage<'a>
Auto Trait Implementations§
impl<'a> Freeze for GenericImage<'a>
impl<'a> RefUnwindSafe for GenericImage<'a>
impl<'a> Send for GenericImage<'a>
impl<'a> Sync for GenericImage<'a>
impl<'a> Unpin for GenericImage<'a>
impl<'a> !UnwindSafe for GenericImage<'a>
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)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