pub trait StreamPack:
'static
+ Send
+ Sync {
type StreamInputPack;
type StreamOutputPack;
type StreamReceivers: Send + Sync;
type StreamChannels: Send;
type StreamBuffers: Clone;
Show 14 methods
// Required methods
fn spawn_scope_streams(
in_scope: Entity,
out_scope: Entity,
commands: &mut Commands<'_, '_>,
) -> (Self::StreamInputPack, Self::StreamOutputPack);
fn spawn_workflow_streams(
builder: &mut Builder<'_, '_, '_>,
) -> Self::StreamInputPack;
fn spawn_node_streams(
source: Entity,
map: &mut StreamTargetMap,
builder: &mut Builder<'_, '_, '_>,
) -> Self::StreamOutputPack;
fn take_streams(
source: Entity,
map: &mut StreamTargetMap,
commands: &mut Commands<'_, '_>,
) -> Self::StreamReceivers;
fn collect_streams(
source: Entity,
target: Entity,
map: &mut StreamTargetMap,
commands: &mut Commands<'_, '_>,
);
fn make_stream_channels(
inner: &Arc<InnerChannel>,
world: &World,
) -> Self::StreamChannels;
fn make_stream_buffers(
target_map: Option<&StreamTargetMap>,
) -> Self::StreamBuffers;
fn process_stream_buffers(
buffer: Self::StreamBuffers,
source: Entity,
session: Entity,
unused: &mut UnusedStreams,
world: &mut World,
roster: &mut OperationRoster,
) -> OperationResult;
fn defer_buffers(
buffer: Self::StreamBuffers,
source: Entity,
session: Entity,
commands: &mut Commands<'_, '_>,
);
fn set_stream_availability(availability: &mut StreamAvailability);
fn are_streams_available(availability: &StreamAvailability) -> bool;
fn into_dyn_stream_input_pack(
pack: &mut DynStreamInputPack,
inputs: Self::StreamInputPack,
);
fn into_dyn_stream_output_pack(
pack: &mut DynStreamOutputPack,
outputs: Self::StreamOutputPack,
);
fn has_streams() -> bool;
}Expand description
The StreamPack trait defines the interface for a pack of one or more streams.
Each Provider can provide zero, one, or more streams of data
that may be sent out while it’s running. The StreamPack allows those
streams to be packed together as one generic argument.
To create a stream pack, simply define a struct whose fields are valid message
types and derive the StreamPack trait for it:
#[derive(StreamPack)]
struct NavigationStreams {
log: String,
position: [f32; 2],
}Required Associated Types§
type StreamInputPack
type StreamOutputPack
type StreamReceivers: Send + Sync
type StreamChannels: Send
type StreamBuffers: Clone
Required Methods§
fn spawn_scope_streams( in_scope: Entity, out_scope: Entity, commands: &mut Commands<'_, '_>, ) -> (Self::StreamInputPack, Self::StreamOutputPack)
fn spawn_workflow_streams( builder: &mut Builder<'_, '_, '_>, ) -> Self::StreamInputPack
fn spawn_node_streams( source: Entity, map: &mut StreamTargetMap, builder: &mut Builder<'_, '_, '_>, ) -> Self::StreamOutputPack
fn take_streams( source: Entity, map: &mut StreamTargetMap, commands: &mut Commands<'_, '_>, ) -> Self::StreamReceivers
fn collect_streams( source: Entity, target: Entity, map: &mut StreamTargetMap, commands: &mut Commands<'_, '_>, )
fn make_stream_channels( inner: &Arc<InnerChannel>, world: &World, ) -> Self::StreamChannels
fn make_stream_buffers( target_map: Option<&StreamTargetMap>, ) -> Self::StreamBuffers
fn process_stream_buffers( buffer: Self::StreamBuffers, source: Entity, session: Entity, unused: &mut UnusedStreams, world: &mut World, roster: &mut OperationRoster, ) -> OperationResult
fn defer_buffers( buffer: Self::StreamBuffers, source: Entity, session: Entity, commands: &mut Commands<'_, '_>, )
fn set_stream_availability(availability: &mut StreamAvailability)
fn are_streams_available(availability: &StreamAvailability) -> bool
fn into_dyn_stream_input_pack( pack: &mut DynStreamInputPack, inputs: Self::StreamInputPack, )
fn into_dyn_stream_output_pack( pack: &mut DynStreamOutputPack, outputs: Self::StreamOutputPack, )
Sourcefn has_streams() -> bool
fn has_streams() -> bool
Are there actually any streams in the pack?
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.