pub struct EngineTarget { /* private fields */ }Expand description
Immutable description of one execution engine, used to prepare a program.
A target names the registered engine kind (engine_id), the concrete
engine type (context_identity) and the memory the engine executes on
(allocation_domain, None for host memory). It holds no threads, streams
or memory. crate::Runtime::prepare places each part of a program on one
of the targets it is given, and crate::Runtime::run checks that the
engines it receives report the same targets.
§Examples
use tenferro_runtime::{EngineId, EngineTarget, ExecutionContextIdentity};
struct ExampleEngine;
let target = EngineTarget::new(
EngineId::new("example.engine.v1").unwrap(),
ExecutionContextIdentity::of::<ExampleEngine>(),
None,
);
assert_eq!(target.engine_id().as_str(), "example.engine.v1");
assert!(target.allocation_domain().is_none());Implementations§
Source§impl EngineTarget
impl EngineTarget
Sourcepub fn new(
engine_id: EngineId,
context_identity: ExecutionContextIdentity,
allocation_domain: Option<AllocationDomainId>,
) -> Self
pub fn new( engine_id: EngineId, context_identity: ExecutionContextIdentity, allocation_domain: Option<AllocationDomainId>, ) -> Self
Describe an engine of the registered kind engine_id.
§Examples
use tenferro_runtime::{EngineId, EngineTarget, ExecutionContextIdentity};
struct ExampleEngine;
let target = EngineTarget::new(
EngineId::new("example.engine.v1").unwrap(),
ExecutionContextIdentity::of::<ExampleEngine>(),
None,
);
assert_eq!(target.context_identity(), ExecutionContextIdentity::of::<ExampleEngine>());Sourcepub fn engine_id(&self) -> &EngineId
pub fn engine_id(&self) -> &EngineId
The registered engine kind this target runs as.
§Examples
use tenferro_runtime::{EngineId, EngineTarget, ExecutionContextIdentity};
struct E;
let id = EngineId::new("example.engine.v1").unwrap();
let target = EngineTarget::new(id.clone(), ExecutionContextIdentity::of::<E>(), None);
assert_eq!(target.engine_id(), &id);Sourcepub fn context_identity(&self) -> ExecutionContextIdentity
pub fn context_identity(&self) -> ExecutionContextIdentity
The concrete engine type, checked against the registration.
§Examples
use tenferro_runtime::{EngineId, EngineTarget, ExecutionContextIdentity};
struct E;
let target = EngineTarget::new(
EngineId::new("example.engine.v1").unwrap(),
ExecutionContextIdentity::of::<E>(),
None,
);
assert_eq!(target.context_identity(), ExecutionContextIdentity::of::<E>());Sourcepub fn allocation_domain(&self) -> Option<AllocationDomainId>
pub fn allocation_domain(&self) -> Option<AllocationDomainId>
The memory domain the engine allocates in, None for plain host memory.
§Examples
use tenferro_runtime::{EngineId, EngineTarget, ExecutionContextIdentity};
struct E;
let target = EngineTarget::new(
EngineId::new("example.engine.v1").unwrap(),
ExecutionContextIdentity::of::<E>(),
None,
);
assert_eq!(target.allocation_domain(), None);Trait Implementations§
Source§impl Clone for EngineTarget
impl Clone for EngineTarget
Source§fn clone(&self) -> EngineTarget
fn clone(&self) -> EngineTarget
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for EngineTarget
impl Debug for EngineTarget
impl Eq for EngineTarget
Source§impl Hash for EngineTarget
impl Hash for EngineTarget
Source§impl PartialEq for EngineTarget
impl PartialEq for EngineTarget
impl StructuralPartialEq for EngineTarget
Auto Trait Implementations§
impl Freeze for EngineTarget
impl RefUnwindSafe for EngineTarget
impl Send for EngineTarget
impl Sync for EngineTarget
impl Unpin for EngineTarget
impl UnsafeUnpin for EngineTarget
impl UnwindSafe for EngineTarget
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more