Struct protoflow_blocks::EncodeHex
source · pub struct EncodeHex {
pub input: InputPort<Bytes>,
pub output: OutputPort<Bytes>,
}Expand description
A block that encodes a byte stream into hexadecimal form.
§Block Diagram
block-beta
columns 7
Source space:2 EncodeHex space:2 Sink
Source-- "input" -->EncodeHex
EncodeHex-- "output" -->Sink
classDef block height:48px,padding:8px;
classDef hidden visibility:none;
class EncodeHex block
class Source hidden
class Sink hidden
§Sequence Diagram
sequenceDiagram
autonumber
participant BlockA as Another block
participant EncodeHex.input as EncodeHex.input port
participant EncodeHex as EncodeHex block
participant EncodeHex.output as EncodeHex.output port
participant BlockB as Another block
BlockA-->>EncodeHex: Connect
EncodeHex-->>BlockB: Connect
loop EncodeHex process
BlockA->>EncodeHex: Message (Bytes)
EncodeHex->>EncodeHex: Encode into hexadecimal
EncodeHex->>BlockB: Message (Bytes)
end
BlockA-->>EncodeHex: Disconnect
EncodeHex-->>EncodeHex.input: Close
EncodeHex-->>EncodeHex.output: Close
EncodeHex-->>BlockB: Disconnect
§Examples
§Using the block in a system
System::build(|s| {
let stdin = s.read_stdin();
let hex_encoder = s.encode_hex();
let stdout = s.write_stdout();
s.connect(&stdin.output, &hex_encoder.input);
s.connect(&hex_encoder.output, &stdout.input);
});§Running the block via the CLI
$ protoflow execute EncodeHex
Fields§
§input: InputPort<Bytes>The input byte stream.
output: OutputPort<Bytes>The output text stream.
Implementations§
Trait Implementations§
source§impl Block for EncodeHex
impl Block for EncodeHex
source§fn execute(&mut self, runtime: &dyn BlockRuntime) -> BlockResult
fn execute(&mut self, runtime: &dyn BlockRuntime) -> BlockResult
Executes this block’s computation.
source§fn prepare(&mut self, _runtime: &dyn BlockRuntime) -> Result<(), BlockError>
fn prepare(&mut self, _runtime: &dyn BlockRuntime) -> Result<(), BlockError>
Prepares this block for execution. Read more
source§impl BlockDescriptor for EncodeHex
impl BlockDescriptor for EncodeHex
source§fn inputs(&self) -> Vec<PortDescriptor>
fn inputs(&self) -> Vec<PortDescriptor>
A description of this block’s input ports.
source§fn outputs(&self) -> Vec<PortDescriptor>
fn outputs(&self) -> Vec<PortDescriptor>
A description of this block’s output ports.
source§impl Definition for EncodeHex
impl Definition for EncodeHex
fn is_variation(&self) -> bool
source§impl Element for EncodeHex
impl Element for EncodeHex
source§fn short_name(&self) -> Option<&str>
fn short_name(&self) -> Option<&str>
The short name of the element, if any.
source§fn is_library_element(&self) -> bool
fn is_library_element(&self) -> bool
Whether this
Element is contained in the ownership tree of
a library model.source§fn owning_namespace(&self) -> Option<&dyn Namespace>
fn owning_namespace(&self) -> Option<&dyn Namespace>
source§fn owning_relationship(&self) -> Option<&dyn Relationship>
fn owning_relationship(&self) -> Option<&dyn Relationship>
fn qualified_name(&self) -> Option<QualifiedName>
source§impl OccurrenceDefinition for EncodeHex
impl OccurrenceDefinition for EncodeHex
fn is_individual(&self) -> bool
source§impl StdioSystem for EncodeHex
impl StdioSystem for EncodeHex
fn build_system(_config: StdioConfig) -> Result<System, StdioError>
source§impl Type for EncodeHex
impl Type for EncodeHex
fn is_abstract(&self) -> bool
fn is_sufficient(&self) -> bool
fn is_conjugated(&self) -> bool
fn specializes(&self, _supertype: &Self) -> bool
impl BlockDefinition for EncodeHex
impl Class for EncodeHex
impl Classifier for EncodeHex
impl ItemDefinition for EncodeHex
impl PartDefinition for EncodeHex
impl Structure for EncodeHex
Auto Trait Implementations§
impl Freeze for EncodeHex
impl !RefUnwindSafe for EncodeHex
impl Send for EncodeHex
impl Sync for EncodeHex
impl Unpin for EncodeHex
impl !UnwindSafe for EncodeHex
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,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)