Skip to main content

FileNaming

Enum FileNaming 

Source
#[non_exhaustive]
pub enum FileNaming { Exact, Indexed, Pattern(String), }
Expand description

How a recorder names the files of a session from its RecordingTarget.

The directory the name leads to must exist and be writable. See Self::Exact for the tested exclusive-open behavior and the limits of preflight.

The expanded filename must be absolute. It must fit exactly in the recorder’s event field, at most 4094 UTF-8 bytes with the current SDK. Preflight counts the spelling the SDK will use, including redundant separators and . components, and reserves at least 20 digits for each index token to cover future rollovers. Start and rollover refuse relative or oversized filenames with Error::InvalidInput.

Preflight checks the exact filename or the first indexed candidate against the destination filesystem. If later indexes can add digits, it also checks a candidate with the maximum index width. Start and rollover return Error::Io if the widest basename exceeds a filesystem limit, even when the first candidate fits. Shorten the basename prefix or remove a repeated index token to fit the limit.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Exact

Name each file exactly as its RecordingTarget says, with no index.

FileRecorder::start and FileRecorder::rollover refuse a target that already exists with an Error::Io of kind AlreadyExists, before the SDK is called. This preflight does not reserve the path. A collision created after the check is handled by the native library; a rollover may return success before its later open fails and stops the session. Linux File SDK 6.4.0.2 uses exclusive creation and preserves existing files, including symlinks, in this race. Other platforms and SDK releases have not been verified. Use a recorder-controlled output directory when uninterrupted recording or destination containment matters; mutable parent directories are not pinned by this API.

One target names one file, so a session cannot move to a new file by itself:

FileRecorder::rollover to a new target still works. Use Indexed, or a Pattern with {index}, for recordings that must survive these changes.

§

Indexed

The SDK’s indexed {prefix}_{index:03}.mkv: the target take becomes take_001.mkv, and each new file of the session takes the lowest unused index.

§

Pattern(String)

A filename pattern using {prefix}, {index} and {index:N} tokens.

{prefix} is replaced by the RecordingTarget, and {index:N} pads the index with zeros to N digits, from 1 through 1024. The pattern may name a directory, for example {prefix}/{index:03}.mkv; that directory must exist. Index tokens must be in the file name: directories may come only from literal text and {prefix}. A pattern placing an index in a directory is refused when the recorder is created.

Use {prefix}{index}.mkv with RecordingTarget::new("take") to write take1.mkv in the directory in effect when the target is built. A pattern may also contain a literal absolute path.

A pattern without {index} or {index:N} names its file exactly, with every rule of Exact.

A pattern that is empty, or has an unknown token or unbalanced braces, is refused with Error::InvalidInput when the recorder is created, and one that contains a NUL with Error::InvalidCString.

Trait Implementations§

Source§

impl Clone for FileNaming

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FileNaming

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FileNaming

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for FileNaming

Source§

impl Hash for FileNaming

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FileNaming

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FileNaming

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.