Skip to main content

ProtobufEngine

Struct ProtobufEngine 

Source
pub struct ProtobufEngine;
Expand description

The Protobuf projection engine.

This struct provides methods to convert a SEA Graph into Protobuf IR which can then be serialized to .proto text format.

Implementations§

Source§

impl ProtobufEngine

Source

pub fn project(graph: &Graph, namespace: &str, package: &str) -> ProtoFile

Project a SEA Graph to a ProtoFile.

§Arguments
  • graph - The semantic graph to project
  • namespace - Filter to only include entities/resources from this namespace (empty = all)
  • package - The Protobuf package name to use
§Returns

A ProtoFile containing the generated Protobuf IR.

Source

pub fn project_with_options( graph: &Graph, namespace: &str, package: &str, projection_name: &str, include_governance: bool, ) -> ProtoFile

Project with options for a projection contract.

Source

pub fn project_with_full_options( graph: &Graph, namespace: &str, package: &str, projection_name: &str, include_governance: bool, include_services: bool, ) -> ProtoFile

Project with all options including gRPC service generation.

Source

pub fn project_multi_file( graph: &Graph, base_package: &str, include_governance: bool, include_services: bool, ) -> BTreeMap<PathBuf, ProtoFile>

Project a SEA Graph to multiple ProtoFiles (one per namespace).

This method partitions the graph by namespace, creating a separate .proto file for each. Cross-namespace references are automatically resolved by adding imports and fully qualifying type names.

§Arguments
  • graph - The semantic graph to project
  • base_package - The root package name (e.g. “sea.generated”)
  • include_governance - Whether to include governance messages
  • include_services - Whether to generate gRPC services
§Returns

A map of relative file paths to ProtoFile definitions.

Source

pub fn flows_to_services(graph: &Graph, namespace: &str) -> Vec<ProtoService>

This method groups flows by their destination entity (service provider) and creates RPC methods for each flow. The naming convention follows gRPC best practices: {DestinationEntity}Service.

§Example

A flow Customer -> PaymentProcessor of PaymentRequest generates:

service PaymentProcessorService {
  rpc ProcessPaymentRequest(PaymentRequest) returns (PaymentRequestResponse);
}
Source

pub fn collect_response_messages(services: &[ProtoService]) -> Vec<ProtoMessage>

Auto Trait Implementations§

Blanket Implementations§

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> 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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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.