#[non_exhaustive]pub enum EntryValue {
Show 21 variants
Text(String),
URational(URational),
IRational(IRational),
U8(u8),
U16(u16),
U32(u32),
U64(u64),
I8(i8),
I16(i16),
I32(i32),
I64(i64),
F32(f32),
F64(f64),
DateTime(DateTime<FixedOffset>),
NaiveDateTime(NaiveDateTime),
Undefined(Vec<u8>),
URationalArray(Vec<URational>),
IRationalArray(Vec<IRational>),
U8Array(Vec<u8>),
U16Array(Vec<u16>),
U32Array(Vec<u32>),
}Expand description
Represent a parsed entry value.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Text(String)
URational(URational)
IRational(IRational)
U8(u8)
U16(u16)
U32(u32)
U64(u64)
I8(i8)
I16(i16)
I32(i32)
I64(i64)
F32(f32)
F64(f64)
DateTime(DateTime<FixedOffset>)
NaiveDateTime(NaiveDateTime)
Undefined(Vec<u8>)
URationalArray(Vec<URational>)
IRationalArray(Vec<IRational>)
U8Array(Vec<u8>)
U16Array(Vec<u16>)
U32Array(Vec<u32>)
Implementations§
Source§impl EntryValue
impl EntryValue
pub fn as_str(&self) -> Option<&str>
Sourcepub fn as_datetime(&self) -> Option<ExifDateTime>
pub fn as_datetime(&self) -> Option<ExifDateTime>
EXIF datetime accessor.
Returns Some(ExifDateTime::Aware) when the parsed value carried a
timezone (e.g. composed with OffsetTimeOriginal); returns
Some(ExifDateTime::Naive) for tags that ship without timezone info;
returns None for non-datetime values.
use nom_exif::*;
use chrono::{DateTime, NaiveDateTime, FixedOffset};
let dt = DateTime::parse_from_str("2023-07-09T20:36:33+08:00", "%+").unwrap();
let ev = EntryValue::DateTime(dt);
assert!(matches!(ev.as_datetime(), Some(ExifDateTime::Aware(_))));
let ndt = NaiveDateTime::parse_from_str("2023-07-09T20:36:33", "%Y-%m-%dT%H:%M:%S").unwrap();
let ev = EntryValue::NaiveDateTime(ndt);
assert!(matches!(ev.as_datetime(), Some(ExifDateTime::Naive(_))));pub fn as_u8(&self) -> Option<u8>
pub fn as_i8(&self) -> Option<i8>
pub fn as_u16(&self) -> Option<u16>
pub fn as_i16(&self) -> Option<i16>
pub fn as_u64(&self) -> Option<u64>
pub fn as_u32(&self) -> Option<u32>
pub fn as_i32(&self) -> Option<i32>
pub fn as_i64(&self) -> Option<i64>
pub fn as_f64(&self) -> Option<f64>
Sourcepub fn try_as_integer(&self) -> Option<i64>
pub fn try_as_integer(&self) -> Option<i64>
Widen any integer EntryValue to i64. Returns None for non-integer values (and for U64 values exceeding i64::MAX).
Sourcepub fn try_as_float(&self) -> Option<f64>
pub fn try_as_float(&self) -> Option<f64>
Widen any numeric EntryValue (integer / rational / float) to f64. Rationals with denominator=0 return None.
pub fn as_urational(&self) -> Option<URational>
pub fn as_irational(&self) -> Option<IRational>
pub fn as_urational_slice(&self) -> Option<&[URational]>
pub fn as_irational_slice(&self) -> Option<&[IRational]>
pub fn as_u8_slice(&self) -> Option<&[u8]>
pub fn as_u16_slice(&self) -> Option<&[u16]>
pub fn as_u32_slice(&self) -> Option<&[u32]>
pub fn as_undefined(&self) -> Option<&[u8]>
Trait Implementations§
Source§impl Clone for EntryValue
impl Clone for EntryValue
Source§fn clone(&self) -> EntryValue
fn clone(&self) -> EntryValue
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EntryValue
impl Debug for EntryValue
Source§impl Display for EntryValue
impl Display for EntryValue
Source§impl From<&str> for EntryValue
impl From<&str> for EntryValue
Source§impl From<(NaiveDateTime, Option<FixedOffset>)> for EntryValue
impl From<(NaiveDateTime, Option<FixedOffset>)> for EntryValue
Source§fn from(value: (NaiveDateTime, Option<FixedOffset>)) -> Self
fn from(value: (NaiveDateTime, Option<FixedOffset>)) -> Self
Converts to this type from the input type.
Source§impl From<DateTime<FixedOffset>> for EntryValue
impl From<DateTime<FixedOffset>> for EntryValue
Source§fn from(value: DateTime<FixedOffset>) -> Self
fn from(value: DateTime<FixedOffset>) -> Self
Converts to this type from the input type.
Source§impl From<String> for EntryValue
impl From<String> for EntryValue
Source§impl From<f32> for EntryValue
impl From<f32> for EntryValue
Source§impl From<f64> for EntryValue
impl From<f64> for EntryValue
Source§impl From<i16> for EntryValue
impl From<i16> for EntryValue
Source§impl From<i32> for EntryValue
impl From<i32> for EntryValue
Source§impl From<i64> for EntryValue
impl From<i64> for EntryValue
Source§impl From<i8> for EntryValue
impl From<i8> for EntryValue
Source§impl From<u16> for EntryValue
impl From<u16> for EntryValue
Source§impl From<u32> for EntryValue
impl From<u32> for EntryValue
Source§impl From<u64> for EntryValue
impl From<u64> for EntryValue
Source§impl From<u8> for EntryValue
impl From<u8> for EntryValue
Source§impl PartialEq for EntryValue
impl PartialEq for EntryValue
Source§fn eq(&self, other: &EntryValue) -> bool
fn eq(&self, other: &EntryValue) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for EntryValue
Available on crate feature serde only.
impl Serialize for EntryValue
Available on crate feature
serde only.impl StructuralPartialEq for EntryValue
Auto Trait Implementations§
impl Freeze for EntryValue
impl RefUnwindSafe for EntryValue
impl Send for EntryValue
impl Sync for EntryValue
impl Unpin for EntryValue
impl UnsafeUnpin for EntryValue
impl UnwindSafe for EntryValue
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