pub struct FileRules { /* private fields */ }Expand description
Holds filename-based routing rules that map media paths to color spaces.
Implementations§
Source§impl FileRules
impl FileRules
Sourcepub const DEFAULT_RULE_NAME: &'static str = "Default"
pub const DEFAULT_RULE_NAME: &'static str = "Default"
Native name of the mandatory final rule.
Sourcepub const FILE_PATH_SEARCH_RULE_NAME: &'static str = "ColorSpaceNamePathSearch"
pub const FILE_PATH_SEARCH_RULE_NAME: &'static str = "ColorSpaceNamePathSearch"
Native name of the special color-space-name path search rule.
Sourcepub fn create_editable_copy(&self) -> Result<Self>
pub fn create_editable_copy(&self) -> Result<Self>
Create an editable deep copy of these file rules.
Sourcepub fn num_entries(&self) -> u64
pub fn num_entries(&self) -> u64
Get the total number of rule entries.
Sourcepub fn index_for_rule(&self, rule_name: impl AsRef<str>) -> u64
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.
Sourcepub fn try_index_for_rule(&self, rule_name: impl AsRef<str>) -> Result<u64>
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.
Sourcepub fn rule_index(&self, rule_name: impl AsRef<str>) -> Option<u64>
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.
Sourcepub fn try_name(&self, rule_index: u64) -> Result<Option<String>>
pub fn try_name(&self, rule_index: u64) -> Result<Option<String>>
Get a rule name while preserving invalid-index and bridge failures.
Sourcepub fn pattern(&self, rule_index: u64) -> Option<String>
pub fn pattern(&self, rule_index: u64) -> Option<String>
Get the filename pattern for the rule at the given index.
Sourcepub fn try_pattern(&self, rule_index: u64) -> Result<Option<String>>
pub fn try_pattern(&self, rule_index: u64) -> Result<Option<String>>
Get a filename pattern while preserving invalid-index and bridge failures.
Sourcepub fn set_pattern(
&self,
rule_index: u64,
pattern: impl AsRef<str>,
) -> Result<()>
pub fn set_pattern( &self, rule_index: u64, pattern: impl AsRef<str>, ) -> Result<()>
Set the filename pattern for the rule at the given index.
Sourcepub fn extension(&self, rule_index: u64) -> Option<String>
pub fn extension(&self, rule_index: u64) -> Option<String>
Get the file extension for the rule at the given index.
Sourcepub fn try_extension(&self, rule_index: u64) -> Result<Option<String>>
pub fn try_extension(&self, rule_index: u64) -> Result<Option<String>>
Get a file extension while preserving invalid-index and bridge failures.
Sourcepub fn set_extension(
&self,
rule_index: u64,
extension: impl AsRef<str>,
) -> Result<()>
pub fn set_extension( &self, rule_index: u64, extension: impl AsRef<str>, ) -> Result<()>
Set the file extension for the rule at the given index.
Sourcepub fn regex(&self, rule_index: u64) -> Option<String>
pub fn regex(&self, rule_index: u64) -> Option<String>
Get the regex pattern for the rule at the given index.
Sourcepub fn try_regex(&self, rule_index: u64) -> Result<Option<String>>
pub fn try_regex(&self, rule_index: u64) -> Result<Option<String>>
Get a regex pattern while preserving invalid-index and bridge failures.
Sourcepub fn set_regex(&self, rule_index: u64, regex: impl AsRef<str>) -> Result<()>
pub fn set_regex(&self, rule_index: u64, regex: impl AsRef<str>) -> Result<()>
Set the regex pattern for the rule at the given index.
Sourcepub fn color_space(&self, rule_index: u64) -> Option<String>
pub fn color_space(&self, rule_index: u64) -> Option<String>
Get the color space name for the rule at the given index.
Sourcepub fn try_color_space(&self, rule_index: u64) -> Result<Option<String>>
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.
Sourcepub fn set_color_space(
&self,
rule_index: u64,
color_space: impl AsRef<str>,
) -> Result<()>
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.
Sourcepub fn num_custom_keys(&self, rule_index: u64) -> u64
pub fn num_custom_keys(&self, rule_index: u64) -> u64
Get the number of custom keys on the rule at the given index.
Sourcepub fn try_num_custom_keys(&self, rule_index: u64) -> Result<u64>
pub fn try_num_custom_keys(&self, rule_index: u64) -> Result<u64>
Get the number of custom keys, preserving invalid-index and bridge failures.
Sourcepub fn custom_key_name(&self, rule_index: u64, key: u64) -> Option<String>
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.
Sourcepub fn try_custom_key_name(
&self,
rule_index: u64,
key: u64,
) -> Result<Option<String>>
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.
Sourcepub fn custom_key_value(&self, rule_index: u64, key: u64) -> Option<String>
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.
Sourcepub fn try_custom_key_value(
&self,
rule_index: u64,
key: u64,
) -> Result<Option<String>>
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.
Sourcepub fn set_custom_key(
&self,
rule_index: u64,
key: impl AsRef<str>,
value: impl AsRef<str>,
) -> Result<()>
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.
Sourcepub 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<()>
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.
Sourcepub fn insert_rule_regex(
&self,
rule_index: u64,
name: impl AsRef<str>,
color_space: impl AsRef<str>,
regex: impl AsRef<str>,
) -> Result<()>
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.
pub fn insert_rule_v1( &self, rule_index: u64, name: impl AsRef<str>, color_space: impl AsRef<str>, regex: impl AsRef<str>, ) -> Result<()>
compat alias; prefer insert_rule_regex()
pub fn insert_path_search_rule(&self, rule_index: u64)
panics on OCIO errors; prefer try_insert_path_search_rule()
Sourcepub fn try_insert_path_search_rule(&self, rule_index: u64) -> Result<()>
pub fn try_insert_path_search_rule(&self, rule_index: u64) -> Result<()>
Insert OCIO’s built-in path-search rule at rule_index.
Sourcepub fn set_default_rule_color_space(
&self,
color_space: impl AsRef<str>,
) -> Result<()>
pub fn set_default_rule_color_space( &self, color_space: impl AsRef<str>, ) -> Result<()>
Set the default color space used when no rule matches.
pub fn remove_rule(&self, rule_index: u64)
panics on OCIO errors; prefer try_remove_rule()
Sourcepub fn try_remove_rule(&self, rule_index: u64) -> Result<()>
pub fn try_remove_rule(&self, rule_index: u64) -> Result<()>
Remove the rule at rule_index.
pub fn increase_rule_priority(&self, rule_index: u64)
panics on OCIO errors; prefer try_increase_rule_priority()
Sourcepub fn try_increase_rule_priority(&self, rule_index: u64) -> Result<()>
pub fn try_increase_rule_priority(&self, rule_index: u64) -> Result<()>
Move the rule at rule_index toward the front of the rule list.
pub fn decrease_rule_priority(&self, rule_index: u64)
panics on OCIO errors; prefer try_decrease_rule_priority()
Sourcepub fn try_decrease_rule_priority(&self, rule_index: u64) -> Result<()>
pub fn try_decrease_rule_priority(&self, rule_index: u64) -> Result<()>
Move the rule at rule_index toward the end of the rule list.
Sourcepub fn is_default(&self) -> bool
pub fn is_default(&self) -> bool
Check whether the file rules are in their default (empty) state.