pub(super) struct DetectingState {
encoding_hint_from_content_type: Option<&'static Encoding>,
encoding_of_container_document: Option<&'static Encoding>,
start_timestamp: Instant,
attempted_bom_sniffing: bool,
buffered_bytes: Vec<u8>,
}Fields§
§encoding_hint_from_content_type: Option<&'static Encoding>The charset that was specified in the Content-Type header, if any.
encoding_of_container_document: Option<&'static Encoding>The encoding of a same-origin container document, if this document is in an
<iframe>.
start_timestamp: Instant§attempted_bom_sniffing: bool§buffered_bytes: Vec<u8>Implementations§
Source§impl DetectingState
impl DetectingState
Sourceconst BUFFER_THRESHOLD: usize = 1_024usize
const BUFFER_THRESHOLD: usize = 1_024usize
The maximum amount of bytes to buffer before attempting to determine the encoding
Sourceconst MAX_TIME_TO_BUFFER: Duration
const MAX_TIME_TO_BUFFER: Duration
The time threshold after which we will attempt to determine the encoding and start decoding, even if there are less than [BUFFER_THRESHOLD] bytes in the buffer.
Sourcefn buffer(
&mut self,
data: &[u8],
document: &Document,
is_at_end_of_file: AtEndOfFile,
) -> Option<&'static Encoding>
fn buffer( &mut self, data: &[u8], document: &Document, is_at_end_of_file: AtEndOfFile, ) -> Option<&'static Encoding>
Appends some data to the internal buffer and attempts to determine the character encoding.
If an encoding was detected then it is returned. A return value of None indicates that
more bytes are required.
Sourcefn determine_the_character_encoding(
&mut self,
document: &Document,
potentially_wait_for_more_data: bool,
is_at_end_of_file: AtEndOfFile,
) -> Option<&'static Encoding>
fn determine_the_character_encoding( &mut self, document: &Document, potentially_wait_for_more_data: bool, is_at_end_of_file: AtEndOfFile, ) -> Option<&'static Encoding>
fn finish(&mut self, document: &Document) -> &'static Encoding
Trait Implementations§
Source§impl MallocSizeOf for DetectingState
impl MallocSizeOf for DetectingState
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Measure the heap usage of all descendant heap-allocated structures, but
not the space taken up by the value itself.
Auto Trait Implementations§
impl Freeze for DetectingState
impl RefUnwindSafe for DetectingState
impl Send for DetectingState
impl Sync for DetectingState
impl Unpin for DetectingState
impl UnwindSafe for DetectingState
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
Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert