Skip to main content

FbxReadOptions

Struct FbxReadOptions 

Source
#[non_exhaustive]
pub struct FbxReadOptions { pub limits: FbxDecodeLimits, pub strict: bool, }
Available on crate feature fbx-reader only.
Expand description

How the FBX reader treats a document: what it may allocate, and how strictly it enforces the binary container layout.

use draco_io::{FbxDecodeLimits, FbxReadOptions, FbxScene};

// Tighten the blob ceiling for untrusted input: embedded textures arrive
// as `R` properties and are the largest thing a document can claim.
let options = FbxReadOptions::default()
    .with_limits(FbxDecodeLimits::default().with_max_blob_bytes(16 << 20));

match FbxScene::from_bytes_with_options(b"not an fbx file", options) {
    Ok(scene) => println!("{} root nodes", scene.root_nodes.len()),
    Err(error) => {
        // `OutOfMemory` means "too big, retry with `permissive()`";
        // `InvalidData` means the document is corrupt.
        assert_eq!(error.kind(), std::io::ErrorKind::InvalidData);
    }
}

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§limits: FbxDecodeLimits

Allocation ceilings for this read.

§strict: bool

Reject anything the FBX binary layout does not strictly permit.

Off by default: shipping exporters emit slop that every practical reader tolerates, so strictness is opt-in for validation tools.

Implementations§

Source§

impl FbxReadOptions

Source

pub fn strict() -> Self

Options that reject any deviation from the documented layout.

Source

pub fn with_limits(self, limits: FbxDecodeLimits) -> Self

Replaces the allocation ceilings.

Source

pub fn with_strict(self, strict: bool) -> Self

Enables or disables strict container validation.

Trait Implementations§

Source§

impl Clone for FbxReadOptions

Source§

fn clone(&self) -> FbxReadOptions

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 FbxReadOptions

Source§

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

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

impl Default for FbxReadOptions

Source§

fn default() -> FbxReadOptions

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

impl Eq for FbxReadOptions

Source§

impl PartialEq for FbxReadOptions

Source§

fn eq(&self, other: &FbxReadOptions) -> 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 FbxReadOptions

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.