Skip to main content

FileRules

Struct FileRules 

Source
pub struct FileRules { /* private fields */ }
Expand description

Holds filename-based routing rules that map media paths to color spaces.

Implementations§

Source§

impl FileRules

Source

pub const DEFAULT_RULE_NAME: &'static str = "Default"

Native name of the mandatory final rule.

Source

pub const FILE_PATH_SEARCH_RULE_NAME: &'static str = "ColorSpaceNamePathSearch"

Native name of the special color-space-name path search rule.

Source

pub fn create() -> Result<Self>

Create file rules containing OCIO’s mandatory default rule.

Source

pub fn create_editable_copy(&self) -> Result<Self>

Create an editable deep copy of these file rules.

Source

pub fn num_entries(&self) -> u64

Get the total number of rule entries.

Source

pub fn index_for_rule(&self, rule_name: impl AsRef<str>) -> u64

Look up the index for a rule name using OCIO’s case-insensitive matching.

This compatibility method returns u64::MAX when OCIO rejects the name. Prefer Self::try_index_for_rule to preserve the OCIO error, or Self::rule_index for an optional lookup.

Source

pub fn try_index_for_rule(&self, rule_name: impl AsRef<str>) -> Result<u64>

Look up a rule index while preserving OCIO missing-rule errors.

Source

pub fn rule_index(&self, rule_name: impl AsRef<str>) -> Option<u64>

Look up the index for a rule name.

Returns None when the rule is absent or the rule name is not a valid C string for the OCIO ABI.

Source

pub fn name(&self, rule_index: u64) -> Option<String>

Get the rule name at the given index.

Source

pub fn try_name(&self, rule_index: u64) -> Result<Option<String>>

Get a rule name while preserving invalid-index and bridge failures.

Source

pub fn pattern(&self, rule_index: u64) -> Option<String>

Get the filename pattern for the rule at the given index.

Source

pub fn try_pattern(&self, rule_index: u64) -> Result<Option<String>>

Get a filename pattern while preserving invalid-index and bridge failures.

Source

pub fn set_pattern( &self, rule_index: u64, pattern: impl AsRef<str>, ) -> Result<()>

Set the filename pattern for the rule at the given index.

Source

pub fn extension(&self, rule_index: u64) -> Option<String>

Get the file extension for the rule at the given index.

Source

pub fn try_extension(&self, rule_index: u64) -> Result<Option<String>>

Get a file extension while preserving invalid-index and bridge failures.

Source

pub fn set_extension( &self, rule_index: u64, extension: impl AsRef<str>, ) -> Result<()>

Set the file extension for the rule at the given index.

Source

pub fn regex(&self, rule_index: u64) -> Option<String>

Get the regex pattern for the rule at the given index.

Source

pub fn try_regex(&self, rule_index: u64) -> Result<Option<String>>

Get a regex pattern while preserving invalid-index and bridge failures.

Source

pub fn set_regex(&self, rule_index: u64, regex: impl AsRef<str>) -> Result<()>

Set the regex pattern for the rule at the given index.

Source

pub fn color_space(&self, rule_index: u64) -> Option<String>

Get the color space name for the rule at the given index.

Source

pub fn try_color_space(&self, rule_index: u64) -> Result<Option<String>>

Get a rule color-space name while preserving invalid-index and bridge failures.

Source

pub fn set_color_space( &self, rule_index: u64, color_space: impl AsRef<str>, ) -> Result<()>

Set the color space name for the rule at the given index.

Source

pub fn num_custom_keys(&self, rule_index: u64) -> u64

Get the number of custom keys on the rule at the given index.

Source

pub fn try_num_custom_keys(&self, rule_index: u64) -> Result<u64>

Get the number of custom keys, preserving invalid-index and bridge failures.

Source

pub fn custom_key_name(&self, rule_index: u64, key: u64) -> Option<String>

Get the name of the custom key at the given key index.

Source

pub fn try_custom_key_name( &self, rule_index: u64, key: u64, ) -> Result<Option<String>>

Get a custom-key name while preserving invalid-index and bridge failures.

Source

pub fn custom_key_value(&self, rule_index: u64, key: u64) -> Option<String>

Get the value of the custom key at the given key index.

Source

pub fn try_custom_key_value( &self, rule_index: u64, key: u64, ) -> Result<Option<String>>

Get a custom-key value while preserving invalid-index and bridge failures.

Source

pub fn set_custom_key( &self, rule_index: u64, key: impl AsRef<str>, value: impl AsRef<str>, ) -> Result<()>

Set a custom key-value pair. An empty value removes the key.

Source

pub fn insert_rule( &self, rule_index: u64, name: impl AsRef<str>, color_space: impl AsRef<str>, pattern: impl AsRef<str>, extension: impl AsRef<str>, ) -> Result<()>

Insert a new rule with a filename pattern and extension at the given index.

Source

pub fn insert_rule_regex( &self, rule_index: u64, name: impl AsRef<str>, color_space: impl AsRef<str>, regex: impl AsRef<str>, ) -> Result<()>

Insert a new rule with a regex pattern at the given index.

Source

pub fn insert_rule_v1( &self, rule_index: u64, name: impl AsRef<str>, color_space: impl AsRef<str>, regex: impl AsRef<str>, ) -> Result<()>

👎Deprecated since 0.2.0:

compat alias; prefer insert_rule_regex()

Source

pub fn insert_path_search_rule(&self, rule_index: u64)

👎Deprecated since 0.2.0:

panics on OCIO errors; prefer try_insert_path_search_rule()

Source

pub fn try_insert_path_search_rule(&self, rule_index: u64) -> Result<()>

Insert OCIO’s built-in path-search rule at rule_index.

Source

pub fn set_default_rule_color_space( &self, color_space: impl AsRef<str>, ) -> Result<()>

Set the default color space used when no rule matches.

Source

pub fn remove_rule(&self, rule_index: u64)

👎Deprecated since 0.2.0:

panics on OCIO errors; prefer try_remove_rule()

Source

pub fn try_remove_rule(&self, rule_index: u64) -> Result<()>

Remove the rule at rule_index.

Source

pub fn increase_rule_priority(&self, rule_index: u64)

👎Deprecated since 0.2.0:

panics on OCIO errors; prefer try_increase_rule_priority()

Source

pub fn try_increase_rule_priority(&self, rule_index: u64) -> Result<()>

Move the rule at rule_index toward the front of the rule list.

Source

pub fn decrease_rule_priority(&self, rule_index: u64)

👎Deprecated since 0.2.0:

panics on OCIO errors; prefer try_decrease_rule_priority()

Source

pub fn try_decrease_rule_priority(&self, rule_index: u64) -> Result<()>

Move the rule at rule_index toward the end of the rule list.

Source

pub fn is_default(&self) -> bool

Check whether the file rules are in their default (empty) state.

Trait Implementations§

Source§

impl Drop for FileRules

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

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> 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
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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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.