Struct xmp_toolkit::XmpMeta
source · [−]pub struct XmpMeta { /* private fields */ }
Expand description
The XmpMeta
struct allows access to the XMP Toolkit core services.
You can create XmpMeta
structs from metadata that you construct,
or that you obtain from files using the XMP Toolkit’s XmpFile
struct.
Implementations
sourceimpl XmpMeta
impl XmpMeta
sourcepub fn register_namespace(namespace_uri: &str, suggested_prefix: &str) -> String
pub fn register_namespace(namespace_uri: &str, suggested_prefix: &str) -> String
Registers a namespace URI with a suggested prefix.
If the URI is not registered but the suggested prefix is in use, a unique prefix is created from the suggested one. The actual registered prefix is returned. It is not an error if the URI is already registered, regardless of the prefix.
Arguments
-
namespace_uri
: The URI for the namespace. Must be a valid XML URI. -
suggested_prefix
: The suggested prefix to be used if the URI is not yet registered. Must be a valid XML name.
Returns the prefix actually registered for this URI.
NOTE: No checking is done on either the URI or the prefix.
sourcepub fn property(&self, schema_ns: &str, prop_name: &str) -> Option<String>
pub fn property(&self, schema_ns: &str, prop_name: &str) -> Option<String>
Gets a property value.
When specifying a namespace and path (in this and all other accessors):
- If a namespace URI is specified, it must be for a registered namespace.
- If the namespace is specified only by a prefix in the property name path, it must be a registered prefix.
- If both a URI and path prefix are present, they must be corresponding parts of a registered namespace.
Arguments
-
schema_ns
: The namespace URI for the property. The URI must be for a registered namespace. Must not be an empty string. -
prop_name
: The name of the property. Can be a general path expression. Must not be an empty string. The first component can be a namespace prefix; if present without aschema_ns
value, the prefix specifies the namespace. The prefix must be for a registered namespace, and if a namespace URI is specified, must match the registered prefix for that namespace.
sourcepub fn set_property(
&mut self,
schema_ns: &str,
prop_name: &str,
prop_value: &str
)
pub fn set_property(
&mut self,
schema_ns: &str,
prop_name: &str,
prop_value: &str
)
Creates or sets a property value.
This is the simplest property setter. Use it for top-level simple properties.
Arguments
-
schema_ns
: The namespace URI; seeproperty()
. -
prop_name
: The name of the property. Can be a general path expression. Must not be an empty string. Seeproperty
for namespace prefix usage. -
prop_value
: The new value.
sourcepub fn set_property_date(
&mut self,
schema_ns: &str,
prop_name: &str,
prop_value: &XmpDateTime
)
pub fn set_property_date(
&mut self,
schema_ns: &str,
prop_name: &str,
prop_value: &XmpDateTime
)
Creates or sets a property value using an XmpDateTeim
structure.
This is the simplest property setter. Use it for top-level simple properties.
Arguments
-
schema_ns
: The namespace URI; seeproperty()
. -
prop_name
: The name of the property. Can be a general path expression. Must not be an empty string. Seeproperty
for namespace prefix usage. -
prop_value
: The new value.
sourcepub fn does_property_exist(&self, schema_ns: &str, prop_name: &str) -> bool
pub fn does_property_exist(&self, schema_ns: &str, prop_name: &str) -> bool
Rreports whether a property currently exists.
Arguments
-
schema_ns
: The namespace URI; seeproperty()
. -
prop_name
: The name of the property. Can be a general path expression. Must not be an empty string. Seeproperty
for namespace prefix usage.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for XmpMeta
impl !Send for XmpMeta
impl !Sync for XmpMeta
impl Unpin for XmpMeta
impl UnwindSafe for XmpMeta
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more