Skip to main content

Item

Struct Item 

Source
pub struct Item {
Show 20 fields pub id: String, pub name: String, pub size: u64, pub btime: u64, pub mtime: u64, pub ext: String, pub tags: Vec<String>, pub folders: Vec<String>, pub is_deleted: bool, pub url: String, pub annotation: String, pub modification_time: u64, pub remove_thumbnail: Option<bool>, pub no_thumbnail: Option<bool>, pub height: u64, pub width: u64, pub last_modified: u64, pub palettes: Vec<Palette>, pub key_order: KeyOrder, pub extra: Extra,
}
Expand description

An item’s images/<ID>.info/metadata.json.

Fields§

§id: String

Item id.

§name: String

Name without extension.

§size: u64

Original file size in bytes.

§btime: u64

Creation time, ms since epoch.

§mtime: u64

File modification time, ms since epoch.

§ext: String

File extension without the dot.

§tags: Vec<String>

Tags.

§folders: Vec<String>

Ids of the folders containing the item.

§is_deleted: bool

Whether the item is in the trash.

§url: String

Source URL.

§annotation: String

Annotation text.

§modification_time: u64

Last modification time of the record, ms since epoch.

§remove_thumbnail: Option<bool>

Present only on some items.

§no_thumbnail: Option<bool>

Present only on some items.

§height: u64

Pixel height.

§width: u64

Pixel width.

§last_modified: u64

Last modification time of the content, ms since epoch.

§palettes: Vec<Palette>

Dominant colours.

§key_order: KeyOrder

The keys of the metadata.json this item was read from, in file order (empty for new items). Writing follows this order, and a field the file didn’t have is left out while it still holds its default, so items round-trip byte for byte. Eagle leaves out width, height and palettes for files it can’t preview, and writes keys such as noPreview and deletedTime mid-record.

§extra: Extra

Unknown keys.

Implementations§

Source§

impl Item

Source

pub fn info_dir(&self, library_root: &Path) -> PathBuf

<library>/images/<id>.info.

Source

pub fn original_path(&self, library_root: &Path) -> PathBuf

Path of the original file, <name>.<ext> inside the info dir.

Source

pub fn thumbnail_name(&self) -> String

The file name of the item’s thumbnail, <name>_thumbnail.png.

Source

pub fn thumbnail_path(&self, library_root: &Path) -> Option<PathBuf>

Path of <name>_thumbnail.png, if that file exists.

Source§

impl Item

Source

pub fn manual_order_text(&self, folder: &str) -> Option<String>

The item’s raw order[folder] text, if it has a usable one.

Source

pub fn manual_order(&self, folder: &str) -> Option<f64>

The item’s manual position value in folder (order[folder]), as a number; None when it has no entry. Larger values come first in an ascending manual sort.

Source

pub fn manual_sort_key(&self, folder: &str) -> String

The text Eagle’s MANUAL sort compares for this item: its entry, or modificationTime when it has none.

Source

pub fn set_manual_order(&mut self, folder: &str, value: &str)

Sets order[folder]. A new order map goes at the end of the record, a new folder key at the end of the map; existing keys keep their place.

Source§

impl Item

Source

pub fn comments(&self) -> Vec<Comment>

The item’s comments (comments in extra), empty when it has none. Entries that are not objects are skipped.

Source

pub fn set_comments(&mut self, comments: &[Comment])

Replaces the item’s comments. The comments key keeps its place in extra, or is added at the end, as Eagle adds it.

Source

pub fn from_json_str(s: &str) -> Result<Item>

Parses an item’s metadata.json, recording its key order.

Trait Implementations§

Source§

impl Clone for Item

Source§

fn clone(&self) -> Item

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 Item

Source§

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

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

impl<'de> Deserialize<'de> for Item

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Item

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl Serialize for Item

Source§

fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Error>

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Item

Auto Trait Implementations§

§

impl Freeze for Item

§

impl RefUnwindSafe for Item

§

impl Send for Item

§

impl Sync for Item

§

impl Unpin for Item

§

impl UnsafeUnpin for Item

§

impl UnwindSafe for Item

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> AutoreleaseSafe for T
where T: ?Sized,

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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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
§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V