[][src]Struct hedwig::Hedwig

pub struct Hedwig<T, P> { /* fields omitted */ }

Central instance to access all Hedwig related resources

Methods

impl<T, P> Hedwig<T, P> where
    P: Publisher
[src]

pub fn new(
    schema: &str,
    publisher_name: &str,
    publisher: P,
    message_router: MessageRouter<T>
) -> Result<Hedwig<T, P>, HedwigError>
[src]

Creates a new Hedwig instance. Application credentials cannot be auto-discovered in Google Cloud environment unlike the Python library.

Arguments

  • schema: The JSON schema content. It's up to the caller to read the schema from a file.
  • publisher name: Name of the publisher service. This will be part of the metadata in the message.
  • publisher - An implementation of Publisher
  • message_router - A function that can route messages to topics

pub fn message<D>(
    &self,
    data_type: T,
    data_schema_version: Version,
    data: D
) -> Result<Message<D, T>, MessageError> where
    D: Serialize,
    T: Copy + Into<&'static str>, 
[src]

Creates a new message with given data type, schema version and data object.

Arguments

  • data_type - An Enum instance with static str representation
  • data_schema_version - Version of the data object
  • data - The message data - must be serializable

pub fn publish<D>(&self, message: Message<D, T>) -> Result<String, PublishError> where
    D: Serialize
[src]

Publish a message using the configured publisher. Returns the publish id if successful. The publish id depends on your publisher.

Arguments

  • message - the message to publish

Auto Trait Implementations

impl<T, P> !Send for Hedwig<T, P>

impl<T, P> Unpin for Hedwig<T, P> where
    P: Unpin

impl<T, P> !Sync for Hedwig<T, P>

impl<T, P> !UnwindSafe for Hedwig<T, P>

impl<T, P> !RefUnwindSafe for Hedwig<T, P>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Typeable for T where
    T: Any

fn get_type(&self) -> TypeId

Get the TypeId of this object.

impl<T> GetTypeId for T where
    T: Any
[src]

fn typeid(&self) -> TypeId[src]