pub struct Def<CTX: Context> { /* private fields */ }
Expand description
Process definition.
Implementations
sourceimpl<CTX: Context> Def<CTX>
impl<CTX: Context> Def<CTX>
sourcepub fn define(
id: CTX::PID,
kind: Kind,
sourcepoints: Vec<CTX::CID>,
endpoints: Vec<CTX::CID>
) -> Result<Self, Vec<DefineError>>
pub fn define(
id: CTX::PID,
kind: Kind,
sourcepoints: Vec<CTX::CID>,
endpoints: Vec<CTX::CID>
) -> Result<Self, Vec<DefineError>>
The only method to create a valid process def struct. Checks for duplicate sourcepoints or endpoints, self-loops, and restrictions on process kind (asynchronous processes are incompatible with certain combinations of backends).
Errors
Duplicate sourcepoint:
let result = process::Def::<Mycontext>::define (
ProcessId::A,
process::Kind::isochronous_default(),
vec![ChannelId::X, ChannelId::Z, ChannelId::X],
vec![ChannelId::Y]);
assert_eq!(
result, Err (vec![process::DefineError::DuplicateSourcepoint]));
Duplicate endpoint:
let result = process::Def::<Mycontext>::define (
ProcessId::A,
process::Kind::isochronous_default(),
vec![ChannelId::X, ChannelId::Z],
vec![ChannelId::Y, ChannelId::Y]);
assert_eq!(
result, Err (vec![process::DefineError::DuplicateEndpoint]));
Self-loop:
let result = process::Def::<Mycontext>::define (
ProcessId::A,
process::Kind::isochronous_default(),
vec![ChannelId::X, ChannelId::Z],
vec![ChannelId::Y, ChannelId::Z]);
assert_eq!(
result, Err (vec![process::DefineError::SourcepointEqEndpoint]));
Asynchronous process zero endpoints:
let result = process::Def::<Mycontext>::define (
ProcessId::A,
process::Kind::asynchronous_default(),
vec![ChannelId::Z],
vec![]);
assert_eq!(
result,
Err (vec![process::DefineError::AsynchronousZeroEndpoints]));
Asynchronous process multiple endpoints:
let result = process::Def::<Mycontext>::define (
ProcessId::A,
process::Kind::asynchronous_default(),
vec![ChannelId::Z],
vec![ChannelId::X, ChannelId::Y]);
assert_eq!(
result,
Err (vec![process::DefineError::AsynchronousMultipleEndpoints]));
pub fn id(&self) -> &CTX::PID
pub fn kind(&self) -> &Kind
pub fn sourcepoints(&self) -> &Vec<CTX::CID>
pub fn endpoints(&self) -> &Vec<CTX::CID>
Trait Implementations
sourceimpl<CTX: Clone + Context> Clone for Def<CTX> where
CTX::PID: Clone,
CTX::CID: Clone,
CTX::CID: Clone,
impl<CTX: Clone + Context> Clone for Def<CTX> where
CTX::PID: Clone,
CTX::CID: Clone,
CTX::CID: Clone,
sourceimpl<CTX: Debug + Context> Debug for Def<CTX> where
CTX::PID: Debug,
CTX::CID: Debug,
CTX::CID: Debug,
impl<CTX: Debug + Context> Debug for Def<CTX> where
CTX::PID: Debug,
CTX::CID: Debug,
CTX::CID: Debug,
sourceimpl<CTX: PartialEq + Context> PartialEq<Def<CTX>> for Def<CTX> where
CTX::PID: PartialEq,
CTX::CID: PartialEq,
CTX::CID: PartialEq,
impl<CTX: PartialEq + Context> PartialEq<Def<CTX>> for Def<CTX> where
CTX::PID: PartialEq,
CTX::CID: PartialEq,
CTX::CID: PartialEq,
impl<CTX: Eq + Context> Eq for Def<CTX> where
CTX::PID: Eq,
CTX::CID: Eq,
CTX::CID: Eq,
impl<CTX: Context> StructuralEq for Def<CTX>
impl<CTX: Context> StructuralPartialEq for Def<CTX>
Auto Trait Implementations
impl<CTX> RefUnwindSafe for Def<CTX> where
<CTX as Context>::CID: RefUnwindSafe,
<CTX as Context>::PID: RefUnwindSafe,
impl<CTX> Send for Def<CTX> where
<CTX as Context>::CID: Send,
<CTX as Context>::PID: Send,
impl<CTX> Sync for Def<CTX> where
<CTX as Context>::CID: Sync,
<CTX as Context>::PID: Sync,
impl<CTX> Unpin for Def<CTX> where
<CTX as Context>::CID: Unpin,
<CTX as Context>::PID: Unpin,
impl<CTX> UnwindSafe for Def<CTX> where
<CTX as Context>::CID: UnwindSafe,
<CTX as Context>::PID: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more