lrcat/
lib.rs

1/*
2 This Source Code Form is subject to the terms of the Mozilla Public
3 License, v. 2.0. If a copy of the MPL was not distributed with this
4 file, You can obtain one at http://mozilla.org/MPL/2.0/.
5*/
6
7extern crate chrono;
8extern crate peg;
9extern crate rusqlite;
10
11mod catalog;
12mod collections;
13mod content;
14mod folders;
15mod fromdb;
16mod images;
17mod keywords;
18mod keywordtree;
19mod libraryfiles;
20mod lrobject;
21pub mod lron;
22
23/// Point
24#[derive(Debug, PartialEq)]
25pub struct Point {
26    pub x: f64,
27    pub y: f64,
28}
29
30/// Aspect ratio.
31#[derive(Debug, PartialEq)]
32pub struct AspectRatio {
33    pub width: i32,
34    pub height: i32,
35}
36
37/// Rectangle. Lr uses 0..1.0 for
38/// crops rectangles.
39#[derive(Debug, PartialEq)]
40pub struct Rect {
41    pub top: f64,
42    pub bottom: f64,
43    pub left: f64,
44    pub right: f64,
45}
46
47/// Error from the crate, agreggate with sqlite errors.
48#[derive(Debug, thiserror::Error)]
49pub enum Error {
50    #[error("Unimplemented")]
51    /// Unimplemented
52    Unimplemented,
53    #[error("LrCat: Skip.")]
54    /// Skip the item (when reading from Db)
55    Skip,
56    #[error("LrCat: Unsupported catalog version.")]
57    /// Unsupported catalog version
58    UnsupportedVersion,
59    #[error("LrCat: SQL error: {0}")]
60    /// Sql Error
61    Sql(#[from] rusqlite::Error),
62    #[error("LrCat: Lron parsing error: {0}")]
63    /// Lron parsing error
64    Lron(#[from] peg::error::ParseError<peg::str::LineCol>),
65}
66
67/// Result type for the crate.
68pub type Result<T> = std::result::Result<T, Error>;
69
70pub use catalog::{Catalog, CatalogVersion};
71pub use collections::Collection;
72pub use content::Content;
73pub use folders::{Folder, Folders, RootFolder};
74pub use images::Image;
75pub use keywords::Keyword;
76pub use keywordtree::KeywordTree;
77pub use libraryfiles::LibraryFile;
78pub use lrobject::{LrId, LrObject};