Skip to main content

DiagramContext

Struct DiagramContext 

Source
pub struct DiagramContext<'a, 'c, 'w, 's, 'b> {
    pub builder: &'c mut Builder<'w, 's, 'b>,
    pub registry: &'a DiagramElementRegistry,
    pub operations: Operations,
    pub templates: &'a Templates,
    pub on_implicit_error: &'a OperationRef,
    /* private fields */
}

Fields§

§builder: &'c mut Builder<'w, 's, 'b>§registry: &'a DiagramElementRegistry§operations: Operations§templates: &'a Templates§on_implicit_error: &'a OperationRef

Implementations§

Source§

impl<'a, 'c, 'w, 's, 'b> DiagramContext<'a, 'c, 'w, 's, 'b>

Source

pub fn infer_input_type_into_target( &self, id: impl Into<OperationRef>, ) -> Result<Option<TypeInfo>, DiagramErrorCode>

Infer the TypeInfo for the input messages into the specified operation.

If this returns None then not enough of the diagram has been built yet to infer the input type. In that case you can return something like Ok(BuildStatus::defer("waiting for an input")).

The workflow builder will ensure that all outputs targeting this operation are compatible with this message type.

During the ConnectIntoTarget phase all information about outputs going into this target will be drained, so this function is generally not useful during that phase. If you need to retain this information during the ConnectIntoTarget phase then you should capture the TypeInfo that you receive from this function during the BuildDiagramOperation phase.

Source

pub fn infer_buffer_message_type_from_hints( &self, id: impl Into<OperationRef>, ) -> Result<Option<TypeInfo>, DiagramErrorCode>

Source

pub fn redirect_infer_input_type( &self, redirect_to: &OperationRef, visited: &mut HashSet<OperationRef>, ) -> Result<Option<Arc<dyn InferMessageType>>, DiagramErrorCode>

Redirect the inference of an input type to another input. This can be used by implementations of ConnectIntoTarget whose input types are dependent on a downstream operation.

Source

pub fn add_output_into_target( &mut self, target: impl Into<OperationRef>, output: DynOutput, )

Add an output to connect into a target.

This can be used during both the BuildDiagramOperation phase and the ConnectIntoTarget phase.

§Arguments
  • target - The operation that needs to receive the output
  • output - The output channel that needs to be connected into the target.
Source

pub fn set_input_for_target( &mut self, operation: impl Into<OperationRef>, input: DynInputSlot, trace_info: TraceInfo, ) -> Result<(), DiagramErrorCode>

Set the input slot of an operation. This should not be called more than once per operation, because only one input slot can be used for any operation.

This should be used during the BuildDiagramOperation phase to set the input slot of each operation with standard connection behavior. Standard connection behavior means that implicit serialization or deserialization will be applied to its inputs as needed to match the DynInputSlot that you provide.

If you need non-standard connection behavior then you can use Self::set_connect_into_target to set the exact connection behavior. No implicit behaviors will be provided for Self::set_connect_into_target, but you can enable those behaviors using ImplicitSerialization and ImplicitDeserialization.

This should never be used during the ConnectIntoTarget phase because all connection behaviors must already be set by then.

Source

pub fn set_connect_into_target<C: ConnectIntoTarget + 'static>( &mut self, operation: impl Into<OperationRef>, connect: C, ) -> Result<(), DiagramErrorCode>

Set the implementation for how outputs connect into this target. This is a more general method than Self::set_input_for_target.

There will be no additional connection behavior beyond what you specify with the object passed in for connect. That means we will not automatically add implicit serialization or deserialization when you use this method. If you want your connection behavior to have those implicit operations you can use ImplicitSerialization and ImplicitDeserialization inside your connect implementation.

This should never be necessary to use this during the ConnectIntoTarget phase because all connection behaviors should already be set by then.

Source

pub fn set_buffer_for_operation( &mut self, operation: impl Into<OperationRef> + Clone, buffer: AnyBuffer, trace: TraceInfo, ) -> Result<(), DiagramErrorCode>

Set the buffer that should be used for a certain operation. This will also set its connection callback.

Source

pub fn create_buffer_map( &self, inputs: &BufferSelection, ) -> Result<BufferMap, String>

Create a buffer map based on the buffer inputs provided. If one or more of the buffers in BufferInputs is not available, get an error including the name of the missing buffer.

Source

pub fn set_listen_type_hints( &mut self, message_type: &TypeInfo, buffers: &BufferSelection, ) -> Result<(), DiagramErrorCode>

Source

pub fn set_access_type_hints( &mut self, message_type: &TypeInfo, buffers: &BufferSelection, ) -> Result<(), DiagramErrorCode>

Source

pub fn get_implicit_error_target(&self) -> OperationRef

Source

pub fn into_operation_ref(&self, id: impl Into<OperationRef>) -> OperationRef

Source

pub fn into_child_operation_ref( &self, id: &OperationName, child_id: impl Into<OperationRef>, ) -> OperationRef

Source

pub fn add_child_operation<T: BuildDiagramOperation + 'static>( &mut self, id: &OperationName, child_id: &OperationName, op: &Arc<T>, sibling_ops: Operations, scope: Option<BuilderScopeContext>, )

Add an operation which exists as a child inside another operation.

For example this is used by section templates to add their inner operations into the workflow builder.

Operations added this way will be internal to the parent operation, which means they are not “exposed” to be connected to other operations that are not inside the parent.

Use the scope argument if the child operation exists in a different scope than the parent. For the child of a Section, this is None.

Source

pub fn redirect_to_child_input( &mut self, section_id: &OperationName, exposed_id: &OperationName, child_id: &NextOperation, ) -> Result<(), DiagramErrorCode>

Create a connection for an exposed input that allows it to redirect any connections to an internal (child) input.

§Arguments
  • section_id - The ID of the parent operation (e.g. ID of the section) that is exposing an operation to its siblings.
  • exposed_id - The ID of the exposed operation that is being provided by the section. E.g. siblings of the section will refer to the redirected input by { section_id: exposed_id }
  • child_id - The ID of the operation inside the section which the exposed operation ID is being redirected to.

This should not be used to expose a buffer. For that, use Self::redirect_to_child_buffer.

Source

pub fn redirect_to_child_buffer( &mut self, section_id: &OperationName, exposed_id: &OperationName, child_id: &NextOperation, ) -> Result<(), DiagramErrorCode>

Same as Self::redirect_to_child_input, but meant for buffers.

Source

pub fn redirect_exposed_output_to_sibling( &mut self, section_id: &OperationName, output_id: &OperationName, sibling_id: &NextOperation, ) -> Result<(), DiagramErrorCode>

Create a connection for an exposed output that allows it to redirect any connections to an external (sibling) input. This is used to implement the "connect": schema for section templates.

§Arguments
  • section_id - The ID of the parent operation (e.g. ID of the section) that is exposing an output to its siblings.
  • output_id - The ID of the exposed output that is being provided by the section. E.g. siblings of the section will refer to the redirected output by { section_id: output_id }.
  • sibling_id - The sibling of the section that should receive the output.

Trait Implementations§

Source§

impl<'a, 'c, 'w, 's, 'b> Debug for DiagramContext<'a, 'c, 'w, 's, 'b>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, 'c, 'w, 's, 'b> !RefUnwindSafe for DiagramContext<'a, 'c, 'w, 's, 'b>

§

impl<'a, 'c, 'w, 's, 'b> !Send for DiagramContext<'a, 'c, 'w, 's, 'b>

§

impl<'a, 'c, 'w, 's, 'b> !Sync for DiagramContext<'a, 'c, 'w, 's, 'b>

§

impl<'a, 'c, 'w, 's, 'b> !UnwindSafe for DiagramContext<'a, 'c, 'w, 's, 'b>

§

impl<'a, 'c, 'w, 's, 'b> Freeze for DiagramContext<'a, 'c, 'w, 's, 'b>

§

impl<'a, 'c, 'w, 's, 'b> Unpin for DiagramContext<'a, 'c, 'w, 's, 'b>

§

impl<'a, 'c, 'w, 's, 'b> UnsafeUnpin for DiagramContext<'a, 'c, 'w, 's, 'b>

Blanket Implementations§

Source§

impl<Source> AccessAs for Source

Source§

fn ref_as<T>(&self) -> <Source as IGuardRef<T>>::Guard<'_>
where Source: IGuardRef<T>, T: ?Sized,

Provides immutable access to a type as if it were its ABI-unstable equivalent.
Source§

fn mut_as<T>(&mut self) -> <Source as IGuardMut<T>>::GuardMut<'_>
where Source: IGuardMut<T>, T: ?Sized,

Provides mutable access to a type as if it were its ABI-unstable equivalent.
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> AsNode<T> for T

Source§

fn as_node(&self) -> &T

Source§

impl<T> AsNodeMut<T> for T

Source§

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

Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Converts Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Converts &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Converts &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, As> IGuardMut<As> for T
where T: Into<As>, As: Into<T>,

Source§

type GuardMut<'a> = MutAs<'a, T, As> where T: 'a

The type of the guard which will clean up the temporary after applying its changes to the original.
Source§

fn guard_mut_inner(&mut self) -> <T as IGuardMut<As>>::GuardMut<'_>

Construct the temporary and guard it through a mutable reference.
Source§

impl<T, As> IGuardRef<As> for T
where T: Into<As>, As: Into<T>,

Source§

type Guard<'a> = RefAs<'a, T, As> where T: 'a

The type of the guard which will clean up the temporary.
Source§

fn guard_ref_inner(&self) -> <T as IGuardRef<As>>::Guard<'_>

Construct the temporary and guard it through an immutable reference.
Source§

impl<T> Includes<End> for T

Source§

type Output = End

The result
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
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> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more