pub trait SeqAccess<'de> {
type Error: Error;
// Required methods
fn class_ptr(&self) -> Result<usize, Self::Error>;
fn next_primitive_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>
where T: DeserializeSeed<'de>;
fn next_class_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>
where T: DeserializeSeed<'de>;
fn next_math_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>
where T: DeserializeSeed<'de>;
fn next_cstring_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>
where T: DeserializeSeed<'de>;
fn next_stringptr_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>
where T: DeserializeSeed<'de>;
// Provided methods
fn next_primitive_element<T>(&mut self) -> Result<Option<T>, Self::Error>
where T: Deserialize<'de> { ... }
fn next_class_element<T>(&mut self) -> Result<Option<T>, Self::Error>
where T: Deserialize<'de> + HavokClass { ... }
fn next_math_element<T>(&mut self) -> Result<Option<T>, Self::Error>
where T: Deserialize<'de> { ... }
fn next_cstring_element(
&mut self,
) -> Result<Option<CString<'de>>, Self::Error> { ... }
fn next_stringptr_element(
&mut self,
) -> Result<Option<StringPtr<'de>>, Self::Error> { ... }
fn size_hint(&self) -> Option<usize> { ... }
}
Expand description
Provides a Visitor
access to each element of a sequence in the input.
This is a trait that a Deserializer
passes to a Visitor
implementation,
which deserializes each item in a sequence.
§Lifetime
The 'de
lifetime of this trait is the lifetime of data that may be
borrowed by deserialized sequence elements. See the page Understanding
deserializer lifetimes for a more detailed explanation of these lifetimes.
§Example implementation
The example data format presented on the website demonstrates an
implementation of SeqAccess
for a basic JSON data format.
Required Associated Types§
Required Methods§
Sourcefn class_ptr(&self) -> Result<usize, Self::Error>
fn class_ptr(&self) -> Result<usize, Self::Error>
Get current class index attribute(XML: e.g. #0050
) for key of [HashMap
]
Sourcefn next_primitive_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>where
T: DeserializeSeed<'de>,
fn next_primitive_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>where
T: DeserializeSeed<'de>,
This returns Ok(Some(value))
for the next value in the sequence, or
Ok(None)
if there are no more remaining items.
Deserialize
implementations should typically use
SeqAccess::next_primitive_element
instead.
Sourcefn next_class_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>where
T: DeserializeSeed<'de>,
fn next_class_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>where
T: DeserializeSeed<'de>,
This returns Ok(Some(value))
for the next value in the sequence, or
Ok(None)
if there are no more remaining items.
Deserialize
implementations should typically use
SeqAccess::next_class_element
instead.
Sourcefn next_math_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>where
T: DeserializeSeed<'de>,
fn next_math_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>where
T: DeserializeSeed<'de>,
This returns Ok(Some(value))
for the next value in the sequence, or
Ok(None)
if there are no more remaining items.
Deserialize
implementations should typically use
SeqAccess::next_math_element
instead.
Sourcefn next_cstring_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>where
T: DeserializeSeed<'de>,
fn next_cstring_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>where
T: DeserializeSeed<'de>,
This returns Ok(Some(value))
for the next value in the sequence, or
Ok(None)
if there are no more remaining items.
Deserialize
implementations should typically use
SeqAccess::next_cstring_element
instead.
Sourcefn next_stringptr_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>where
T: DeserializeSeed<'de>,
fn next_stringptr_element_seed<T>(
&mut self,
seed: T,
) -> Result<Option<T::Value>, Self::Error>where
T: DeserializeSeed<'de>,
This returns Ok(Some(value))
for the next value in the sequence, or
Ok(None)
if there are no more remaining items.
Deserialize
implementations should typically use
SeqAccess::next_stringptr_element
instead.
Provided Methods§
Sourcefn next_primitive_element<T>(&mut self) -> Result<Option<T>, Self::Error>where
T: Deserialize<'de>,
fn next_primitive_element<T>(&mut self) -> Result<Option<T>, Self::Error>where
T: Deserialize<'de>,
This returns Ok(Some(value))
for the next value in the sequence, or
Ok(None)
if there are no more remaining items.
This method exists as a convenience for Deserialize
implementations.
SeqAccess
implementations should not override the default behavior.
Sourcefn next_class_element<T>(&mut self) -> Result<Option<T>, Self::Error>where
T: Deserialize<'de> + HavokClass,
fn next_class_element<T>(&mut self) -> Result<Option<T>, Self::Error>where
T: Deserialize<'de> + HavokClass,
This returns Ok(Some(value))
for the next value in the sequence, or
Ok(None)
if there are no more remaining items.
This method exists as a convenience for Deserialize
implementations.
SeqAccess
implementations should not override the default behavior.
Sourcefn next_math_element<T>(&mut self) -> Result<Option<T>, Self::Error>where
T: Deserialize<'de>,
fn next_math_element<T>(&mut self) -> Result<Option<T>, Self::Error>where
T: Deserialize<'de>,
This returns Ok(Some(value))
for the next value in the sequence, or
Ok(None)
if there are no more remaining items.
This method exists as a convenience for Deserialize
implementations.
SeqAccess
implementations should not override the default behavior.
Sourcefn next_cstring_element(&mut self) -> Result<Option<CString<'de>>, Self::Error>
fn next_cstring_element(&mut self) -> Result<Option<CString<'de>>, Self::Error>
This returns Ok(Some(value))
for the next value in the sequence, or
Ok(None)
if there are no more remaining items.
This method exists as a convenience for Deserialize
implementations.
SeqAccess
implementations should not override the default behavior.
Sourcefn next_stringptr_element(
&mut self,
) -> Result<Option<StringPtr<'de>>, Self::Error>
fn next_stringptr_element( &mut self, ) -> Result<Option<StringPtr<'de>>, Self::Error>
This returns Ok(Some(value))
for the next value in the sequence, or
Ok(None)
if there are no more remaining items.
This method exists as a convenience for Deserialize
implementations.
SeqAccess
implementations should not override the default behavior.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.