pub struct ContextBuilder { /* private fields */ }
Expand description
Implementations§
Source§impl ContextBuilder
impl ContextBuilder
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new ContextBuilder
with a default empty Interner
and a default BoaProvider
if the intl
feature is enabled.
Sourcepub fn icu_buffer_provider<T: BufferProvider + 'static>(
self,
provider: T,
) -> Result<Self, IcuError>
pub fn icu_buffer_provider<T: BufferProvider + 'static>( self, provider: T, ) -> Result<Self, IcuError>
Provides a BufferProvider
data provider to the Context
.
This function is only available if the intl
feature is enabled.
§Additional considerations
If the data was generated using icu_datagen
, make sure that the deduplication strategy is
not set to Maximal
. Otherwise, icu_datagen
will delete base locales such as “en” from
the list of supported locales if the required data for “en” is the same as “und”.
We recommend RetainBaseLanguages
as a nice default, which will only deduplicate locales
if the deduplication target is not “und”.
§Errors
This returns Err
if the provided provider doesn’t have the required locale information
to construct both a LocaleCanonicalizer
and a LocaleExpander
. Note that this doesn’t
mean that the provider will successfully construct all Intl
services; that check is made
until the creation of an instance of a service.
Sourcepub fn icu_any_provider<T: AnyProvider + 'static>(
self,
provider: T,
) -> Result<Self, IcuError>
pub fn icu_any_provider<T: AnyProvider + 'static>( self, provider: T, ) -> Result<Self, IcuError>
Provides an AnyProvider
data provider to the Context
.
This function is only available if the intl
feature is enabled.
§Additional considerations
If the data was generated using icu_datagen
, make sure that the deduplication strategy is
not set to Maximal
. Otherwise, icu_datagen
will delete base locales such as “en” from
the list of supported locales if the required data for “en” is the same as “und”.
We recommend RetainBaseLanguages
as a nice default, which will only deduplicate locales
if the deduplication target is not “und”.
§Errors
This returns Err
if the provided provider doesn’t have the required locale information
to construct both a LocaleCanonicalizer
and a LocaleExpander
. Note that this doesn’t
mean that the provider will successfully construct all Intl
services; that check is made
until the creation of an instance of a service.
Sourcepub fn host_hooks<H: HostHooks + 'static>(self, host_hooks: &'static H) -> Self
pub fn host_hooks<H: HostHooks + 'static>(self, host_hooks: &'static H) -> Self
Initializes the HostHooks
for the context.
Sourcepub fn job_queue<Q: JobQueue + 'static>(self, job_queue: Rc<Q>) -> Self
pub fn job_queue<Q: JobQueue + 'static>(self, job_queue: Rc<Q>) -> Self
Initializes the JobQueue
for the context.
Sourcepub fn module_loader<M: ModuleLoader + 'static>(
self,
module_loader: Rc<M>,
) -> Self
pub fn module_loader<M: ModuleLoader + 'static>( self, module_loader: Rc<M>, ) -> Self
Initializes the ModuleLoader
for the context.
Sourcepub const fn can_block(self, can_block: bool) -> Self
pub const fn can_block(self, can_block: bool) -> Self
AgentCanSuspend ( )
aka [[CanBlock]]
Defines if this context can be suspended by calls to the Atomics.wait
function.
§Note
By the specification, multiple agents cannot share the same thread if any of them has its
[[CanBlock]]
field set to true. The builder will verify at build time that all contexts on
the current thread fulfill this requisite.
Sourcepub const fn instructions_remaining(self, instructions_remaining: usize) -> Self
pub const fn instructions_remaining(self, instructions_remaining: usize) -> Self
Specifies the number of instructions remaining to the Context
.
This function is only available if the fuzz
feature is enabled.
Trait Implementations§
Source§impl Debug for ContextBuilder
impl Debug for ContextBuilder
Source§impl Default for ContextBuilder
impl Default for ContextBuilder
Source§fn default() -> ContextBuilder
fn default() -> ContextBuilder
Auto Trait Implementations§
impl !Freeze for ContextBuilder
impl !RefUnwindSafe for ContextBuilder
impl !Send for ContextBuilder
impl !Sync for ContextBuilder
impl Unpin for ContextBuilder
impl !UnwindSafe for ContextBuilder
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
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>
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>
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>
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> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self
and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self
, then passes self.as_ref()
into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self
, then passes self.as_mut()
into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self
, then passes self.deref()
into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B>
of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B>
of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R>
view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R>
view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target
of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap()
only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow()
only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref()
only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut()
only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref()
only in debug builds, and is erased in release
builds.