pub struct RoutingHeaders {
pub to: Option<PartyRef>,
pub from: PartyRef,
}transport only.Expand description
The OCPI-to-* and OCPI-from-* headers of one message.
When implementing OCPI these four headers SHALL be implemented for any request/response to/from a Functional Module. This does not mean they have to be present in all request.
to is None for an Open Routing Request, where the
hub decides the destination from the content.
Spec: 2.3.0 §transport_and_format_message_routing
Fields§
§to: Option<PartyRef>The party this message is to be sent to, absent for an Open Routing Request.
from: PartyRefThe party this message is sent from.
Implementations§
Source§impl RoutingHeaders
impl RoutingHeaders
Sourcepub fn open(from: PartyRef) -> Self
pub fn open(from: PartyRef) -> Self
Headers with no to, for an Open Routing Request.
For an Open Routing Request, the TO headers in the request from the requesting party to the Hub MUST be omitted.
Sourcepub fn response_from(&self, responder: PartyRef) -> Self
pub fn response_from(&self, responder: PartyRef) -> Self
The headers of the response to this request, which swap to and from.
For an Open Routing Request the responder is the receiving party, which the requester did
not know; pass it as responder.
Sourcepub fn from_headers(headers: &HeaderMap) -> Option<Self>
pub fn from_headers(headers: &HeaderMap) -> Option<Self>
Reads the routing headers from a header map.
Returns None when the from pair is absent, which is either a spec violation or a
configuration module — see RoutingHeaders::applies_to.
Sourcepub fn applies_to(module: &ModuleId) -> bool
pub fn applies_to(module: &ModuleId) -> bool
Whether these headers belong on a request to module.
The requests/responses to/from Configuration Modules: Credentials, Versions and Hub Client Info are not to be routed, and are for Platform-to-Platform or Platform-to-Hub communication. Thus routing headers SHALL NOT be used with these modules.
Trait Implementations§
Source§impl Clone for RoutingHeaders
impl Clone for RoutingHeaders
Source§fn clone(&self) -> RoutingHeaders
fn clone(&self) -> RoutingHeaders
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RoutingHeaders
impl Debug for RoutingHeaders
Source§impl Display for RoutingHeaders
impl Display for RoutingHeaders
impl Eq for RoutingHeaders
Source§impl PartialEq for RoutingHeaders
impl PartialEq for RoutingHeaders
impl StructuralPartialEq for RoutingHeaders
Auto Trait Implementations§
impl Freeze for RoutingHeaders
impl RefUnwindSafe for RoutingHeaders
impl Send for RoutingHeaders
impl Sync for RoutingHeaders
impl Unpin for RoutingHeaders
impl UnsafeUnpin for RoutingHeaders
impl UnwindSafe for RoutingHeaders
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.