Struct grafana_plugin_sdk::live::Channel[][src]

pub struct Channel { /* fields omitted */ }
Expand description

The identifier of a pub/sub channel in Grafana Live.

Channels are represented as / delimited strings containing their three components, and can be parsed from such strings using str::parse. When included in the Metadata of a Frame, channels are (de)serialized from this format.

// Note that the 'path' can contain '/'s.
let channel: Channel = "plugin/my-cool-plugin/streams/custom-streaming-feature"
    .parse()
    .expect("valid channel");
assert_eq!(channel.scope(), Scope::Plugin);
assert_eq!(channel.namespace().as_str(), "my-cool-plugin");
assert_eq!(channel.path().as_str(), "streams/custom-streaming-feature");
assert_eq!(
    channel.to_string(),
    String::from("plugin/my-cool-plugin/streams/custom-streaming-feature"),
);

See the channel guide for more information.

Implementations

Create a new channel from pre-validated parts.

Get the scope of this channel.

The scope determines the purpose of the channel; for example, channels used internally by Grafana have scope Grafana, while channels used by datasource plugins have scope Datasource.

Get the namespace of this channel.

The namespace has a different meaning depending on scope:

For example, scope Grafana could have a namespace called dashboard, and all messages on such a channel would related to real-time dashboard events.

Get the path of this channel.

The path usually contains the identifier of some concrete resource within a namespace, such as the ID of a dashboard that a user is currently looking at.

This can be anything the plugin author desires, provided it only includes the characters defined in the Path documentation.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Wrap the input message T in a tonic::Request

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

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