INNER CODE UNIT · Rust

read_from

0xMiden/crypto · miden-serde-utils/src/lib.rs:418

    fn read_from<R: ByteReader>(source: &mut R) -> Result<Self, DeserializationError>;

    /// Returns the minimum serialized size for one instance of this type.
    ///
    /// This is used by [`ByteReader::max_alloc`] to estimate how many elements can be
    /// deserialized from the remaining budget, preventing denial-of-service attacks from
    /// malicious length prefixes.
    ///
    /// The default implementation returns `size_of::<Self>()`, which is conservative: it may
    /// reject valid input for types where the serialized size is smaller than the in-memory
    /// size (e.g., structs with computed/cached fields that aren't serialized).
    ///
    /// Override this method for types where the serialized representation is smaller than
    /// the in-memory representation to allow more elements to be deserialized.
    fn min_serialized_size() -> usize {
        size_of::<Self>()
    }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…