#[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: FbxDecodeLimitsAllocation ceilings for this read.
strict: boolReject 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
impl FbxReadOptions
Sourcepub fn with_limits(self, limits: FbxDecodeLimits) -> Self
pub fn with_limits(self, limits: FbxDecodeLimits) -> Self
Replaces the allocation ceilings.
Sourcepub fn with_strict(self, strict: bool) -> Self
pub fn with_strict(self, strict: bool) -> Self
Enables or disables strict container validation.
Trait Implementations§
Source§impl Clone for FbxReadOptions
impl Clone for FbxReadOptions
Source§fn clone(&self) -> FbxReadOptions
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for FbxReadOptions
impl Debug for FbxReadOptions
Source§impl Default for FbxReadOptions
impl Default for FbxReadOptions
Source§fn default() -> FbxReadOptions
fn default() -> FbxReadOptions
Returns the “default value” for a type. Read more
impl Eq for FbxReadOptions
Source§impl PartialEq for FbxReadOptions
impl PartialEq for FbxReadOptions
impl StructuralPartialEq for FbxReadOptions
Auto Trait Implementations§
impl Freeze for FbxReadOptions
impl RefUnwindSafe for FbxReadOptions
impl Send for FbxReadOptions
impl Sync for FbxReadOptions
impl Unpin for FbxReadOptions
impl UnsafeUnpin for FbxReadOptions
impl UnwindSafe for FbxReadOptions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more