pub struct Worker { /* private fields */ }Expand description
Worker context, containing ‘global’ information for the current thread.
Implementations§
Source§impl Worker
impl Worker
pub fn new_for_this_thread(worker_id: WorkerThreadID)
Sourcepub fn with_active_host<F, R>(f: F) -> Option<R>
pub fn with_active_host<F, R>(f: F) -> Option<R>
Run f with a reference to the current Host, or return None if there is no current Host.
Sourcepub fn with_active_process_rc<F, R>(f: F) -> Option<R>
pub fn with_active_process_rc<F, R>(f: F) -> Option<R>
Run f with a reference to the current
RootedRc<RootedRefCell<Process>>, or return None if there isn’t one.
Prefer to pass Process explicitly where feasible. e.g. see ProcessContext.
Sourcepub fn with_active_process<F, R>(f: F) -> Option<R>
pub fn with_active_process<F, R>(f: F) -> Option<R>
Run f with a reference to the current Process, or return None if there isn’t one.
Prefer to pass Process explicitly where feasible. e.g. see ProcessContext.
Sourcepub fn with_active_thread<F, R>(f: F) -> Option<R>
pub fn with_active_thread<F, R>(f: F) -> Option<R>
Run f with a reference to the current Thread, or return None if there isn’t one.
Prefer to pass Thread explicitly where feasible. e.g. see ThreadContext.
Sourcepub fn set_active_host(host: Box<Host>)
pub fn set_active_host(host: Box<Host>)
Set the currently-active Host.
Sourcepub fn take_active_host() -> Box<Host>
pub fn take_active_host() -> Box<Host>
Clear the currently-active Host.
Sourcepub fn set_active_process(process: &RootedRc<RootedRefCell<Process>>)
pub fn set_active_process(process: &RootedRc<RootedRefCell<Process>>)
Set the currently-active Process.
Sourcepub fn clear_active_process()
pub fn clear_active_process()
Clear the currently-active Process.
Sourcepub fn set_active_thread(thread: &RootedRc<RootedRefCell<Thread>>)
pub fn set_active_thread(thread: &RootedRc<RootedRefCell<Thread>>)
Set the currently-active Thread.
Sourcepub fn clear_active_thread()
pub fn clear_active_thread()
Clear the currently-active Thread.
Sourcepub fn worker_id() -> Option<WorkerThreadID>
pub fn worker_id() -> Option<WorkerThreadID>
ID of this thread’s Worker, if any.
pub fn active_process_native_pid() -> Option<Pid>
pub fn active_process_id() -> Option<ProcessId>
pub fn active_thread_id() -> Option<ThreadId>
pub fn active_thread_native_tid() -> Option<Pid>
pub fn set_round_end_time(t: EmulatedTime)
Sourcepub fn max_event_runahead_time(host: &Host) -> EmulatedTime
pub fn max_event_runahead_time(host: &Host) -> EmulatedTime
Maximum time that the current event may run ahead to.
pub fn set_current_time(t: EmulatedTime)
pub fn clear_current_time()
pub fn current_time() -> Option<EmulatedTime>
pub fn update_lowest_used_latency(t: SimulationTime)
pub fn reset_next_event_time()
pub fn get_next_event_time() -> Option<EmulatedTime>
pub fn update_next_event_time(t: EmulatedTime)
Sourcepub fn send_packet(src_host: &Host, packetrc: PacketRc)
pub fn send_packet(src_host: &Host, packetrc: PacketRc)
The packet will be dropped if the packet’s destination IP is not part of the simulation (no host has been configured for the IP).
pub fn increment_object_alloc_counter(s: &str)
pub fn increment_object_dealloc_counter(s: &str)
pub fn add_syscall_counts(syscall_counts: &Counter)
pub fn add_to_global_sim_stats()
pub fn is_routable(src: IpAddr, dst: IpAddr) -> bool
pub fn increment_plugin_error_count()
Sourcepub fn is_bootstrapping() -> bool
pub fn is_bootstrapping() -> bool
Shadow allows configuration of a “bootstrapping” interval, during which
hosts’ network activity does not consume bandwidth. Returns true if we
are still within this preliminary interval, or false otherwise.
pub fn resolve_name_to_ip(name: &CStr) -> Option<Ipv4Addr>
Auto Trait Implementations§
impl !Freeze for Worker
impl !RefUnwindSafe for Worker
impl Send for Worker
impl !Sync for Worker
impl Unpin for Worker
impl UnsafeUnpin for Worker
impl !UnwindSafe for Worker
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> 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 more