pub struct XmpFile(/* private fields */);Expand description
XmpFile extracts an XMP packet and reconciles metadata from the file.
use exempi2::{XmpFile, Xmp, CloseFlags, OpenFlags};
let mut xmpfile = XmpFile::new_from_file("file.jpg", OpenFlags::READ)
.expect("File to open");
let xmp = xmpfile.get_new_xmp().expect("an XMP packet");
xmpfile.close(CloseFlags::NONE).expect("File to close");It also writes back the XMP packet
use exempi2::{XmpFile, Xmp, CloseFlags, OpenFlags, PropFlags};
let mut xmpfile = XmpFile::new_from_file("file.jpg", OpenFlags::FOR_UPDATE)
.expect("File to open");
let mut xmp = xmpfile.get_new_xmp().expect("an XMP packet");
xmp.set_property("some_schema", "some_property", "the value", PropFlags::NONE);
xmpfile.put_xmp(&xmp).expect("being able to put the XMP");
xmpfile.close(CloseFlags::SAFE_UPDATE);Implementations§
Source§impl XmpFile
impl XmpFile
Sourcepub fn new_from_file<P: AsRef<OsStr>>(
path: P,
options: OpenFlags,
) -> Result<XmpFile>
pub fn new_from_file<P: AsRef<OsStr>>( path: P, options: OpenFlags, ) -> Result<XmpFile>
Create and open a new XmpFile Equivalent to calling new then open. Return Err in case of failure
Sourcepub fn open<P: AsRef<OsStr>>(
&mut self,
path: P,
options: OpenFlags,
) -> Result<()>
pub fn open<P: AsRef<OsStr>>( &mut self, path: P, options: OpenFlags, ) -> Result<()>
Open an XmpFile. Usually called after new.
Sourcepub fn close(&mut self, options: CloseFlags) -> Result<()>
pub fn close(&mut self, options: CloseFlags) -> Result<()>
Close the XmpFile
Sourcepub fn get_new_xmp(&self) -> Result<Xmp>
pub fn get_new_xmp(&self) -> Result<Xmp>
Get a new XMP packet from the currently open file
Sourcepub fn get_xmp_xmpstring(&self) -> Result<(XmpString, PacketInfo)>
pub fn get_xmp_xmpstring(&self) -> Result<(XmpString, PacketInfo)>
Get the xmp packet as a string.
Sourcepub fn can_put_xmp(&self, xmp: &Xmp) -> bool
pub fn can_put_xmp(&self, xmp: &Xmp) -> bool
Return true if it can put the Xmp into the XmpFile.
Sourcepub fn can_put_xmp_xmpstring(&self, xmp_packet: &XmpString) -> bool
pub fn can_put_xmp_xmpstring(&self, xmp_packet: &XmpString) -> bool
Return true if it can put the XmpString packet into the XmpFile.
Sourcepub fn can_put_xmp_str(&self, xmp_packet: &str) -> bool
pub fn can_put_xmp_str(&self, xmp_packet: &str) -> bool
Return true if it can put the XmpString packet into the XmpFile.
Sourcepub fn get_file_info(
&self,
file_path: &mut String,
options: &mut OpenFlags,
format: &mut FileType,
handler_flags: &mut FormatOptionFlags,
) -> bool
pub fn get_file_info( &self, file_path: &mut String, options: &mut OpenFlags, format: &mut FileType, handler_flags: &mut FormatOptionFlags, ) -> bool
Get info from the XmpFile.
Sourcepub fn check_file_format<P: AsRef<OsStr>>(path: P) -> FileType
pub fn check_file_format<P: AsRef<OsStr>>(path: P) -> FileType
Check the file format for the specified path
Sourcepub fn get_format_info(format: FileType) -> Result<FormatOptionFlags>
pub fn get_format_info(format: FileType) -> Result<FormatOptionFlags>
Get FormatOptions for the FileType
Trait Implementations§
Auto Trait Implementations§
impl Freeze for XmpFile
impl RefUnwindSafe for XmpFile
impl !Send for XmpFile
impl !Sync for XmpFile
impl Unpin for XmpFile
impl UnwindSafe for XmpFile
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