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: StringItem id.
name: StringName without extension.
size: u64Original file size in bytes.
btime: u64Creation time, ms since epoch.
mtime: u64File modification time, ms since epoch.
ext: StringFile extension without the dot.
Tags.
folders: Vec<String>Ids of the folders containing the item.
is_deleted: boolWhether the item is in the trash.
url: StringSource URL.
annotation: StringAnnotation text.
modification_time: u64Last 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: u64Pixel height.
width: u64Pixel width.
last_modified: u64Last modification time of the content, ms since epoch.
palettes: Vec<Palette>Dominant colours.
key_order: KeyOrderThe 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: ExtraUnknown keys.
Implementations§
Source§impl Item
impl Item
Sourcepub fn original_path(&self, library_root: &Path) -> PathBuf
pub fn original_path(&self, library_root: &Path) -> PathBuf
Path of the original file, <name>.<ext> inside the info dir.
Sourcepub fn thumbnail_name(&self) -> String
pub fn thumbnail_name(&self) -> String
The file name of the item’s thumbnail, <name>_thumbnail.png.
Sourcepub fn thumbnail_path(&self, library_root: &Path) -> Option<PathBuf>
pub fn thumbnail_path(&self, library_root: &Path) -> Option<PathBuf>
Path of <name>_thumbnail.png, if that file exists.
Source§impl Item
impl Item
Sourcepub fn manual_order_text(&self, folder: &str) -> Option<String>
pub fn manual_order_text(&self, folder: &str) -> Option<String>
The item’s raw order[folder] text, if it has a usable one.
Sourcepub fn manual_order(&self, folder: &str) -> Option<f64>
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.
Sourcepub fn manual_sort_key(&self, folder: &str) -> String
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.
Sourcepub fn set_manual_order(&mut self, folder: &str, value: &str)
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
impl Item
Sourcepub fn comments(&self) -> Vec<Comment>
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.
Sourcepub fn set_comments(&mut self, comments: &[Comment])
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.
Sourcepub fn from_json_str(s: &str) -> Result<Item>
pub fn from_json_str(s: &str) -> Result<Item>
Parses an item’s metadata.json, recording its key order.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Item
impl<'de> Deserialize<'de> for Item
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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