Struct Worker

Source
pub struct Worker { /* private fields */ }
Expand description

Worker context, containing ‘global’ information for the current thread.

Implementations§

Source§

impl Worker

Source

pub fn new_for_this_thread(worker_id: WorkerThreadID)

Source

pub fn with_active_host<F, R>(f: F) -> Option<R>
where F: FnOnce(&Host) -> R,

Run f with a reference to the current Host, or return None if there is no current Host.

Source

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.

Source

pub fn with_active_process<F, R>(f: F) -> Option<R>
where F: FnOnce(&Process) -> 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.

Source

pub fn with_active_thread<F, R>(f: F) -> Option<R>
where F: FnOnce(&Thread) -> 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.

Source

pub fn set_active_host(host: Box<Host>)

Set the currently-active Host.

Source

pub fn take_active_host() -> Box<Host>

Clear the currently-active Host.

Source

pub fn set_active_process(process: &RootedRc<RootedRefCell<Process>>)

Set the currently-active Process.

Source

pub fn clear_active_process()

Clear the currently-active Process.

Source

pub fn set_active_thread(thread: &RootedRc<RootedRefCell<Thread>>)

Set the currently-active Thread.

Source

pub fn clear_active_thread()

Clear the currently-active Thread.

Source

pub fn is_alive() -> bool

Whether currently running on a live Worker.

Source

pub fn worker_id() -> Option<WorkerThreadID>

ID of this thread’s Worker, if any.

Source

pub fn active_process_native_pid() -> Option<Pid>

Source

pub fn active_process_id() -> Option<ProcessId>

Source

pub fn active_thread_id() -> Option<ThreadId>

Source

pub fn active_thread_native_tid() -> Option<Pid>

Source

pub fn set_round_end_time(t: EmulatedTime)

Source

pub fn max_event_runahead_time(host: &Host) -> EmulatedTime

Maximum time that the current event may run ahead to.

Source

pub fn set_current_time(t: EmulatedTime)

Source

pub fn clear_current_time()

Source

pub fn current_time() -> Option<EmulatedTime>

Source

pub fn update_lowest_used_latency(t: SimulationTime)

Source

pub fn reset_next_event_time()

Source

pub fn get_next_event_time() -> Option<EmulatedTime>

Source

pub fn update_next_event_time(t: EmulatedTime)

Source

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).

Source

pub fn increment_object_alloc_counter(s: &str)

Source

pub fn increment_object_dealloc_counter(s: &str)

Source

pub fn add_syscall_counts(syscall_counts: &Counter)

Source

pub fn add_to_global_sim_stats()

Source

pub fn is_routable(src: IpAddr, dst: IpAddr) -> bool

Source

pub fn increment_plugin_error_count()

Source

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.

Source

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 !UnwindSafe for Worker

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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 more
Source§

impl<T> NoTypeInference for T

Source§

type This = T

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V