use crate::transport::EndpointPolicy;
use crate::{ProviderId, ProviderMarker, ServiceId, ServiceMarker};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub struct ProviderService<'endpoint> {
provider_id: ProviderId,
service_id: ServiceId,
endpoint_policy: EndpointPolicy<'endpoint>,
}
impl<'endpoint> ProviderService<'endpoint> {
#[must_use]
pub const fn new(
provider_id: ProviderId,
service_id: ServiceId,
endpoint_policy: EndpointPolicy<'endpoint>,
) -> Self {
Self {
provider_id,
service_id,
endpoint_policy,
}
}
#[must_use]
pub const fn from_marker<S: ServiceMarker>(endpoint_policy: EndpointPolicy<'endpoint>) -> Self {
Self::new(<S::Provider as ProviderMarker>::ID, S::ID, endpoint_policy)
}
#[must_use]
pub const fn provider_id(self) -> ProviderId {
self.provider_id
}
#[must_use]
pub const fn service_id(self) -> ServiceId {
self.service_id
}
#[must_use]
pub const fn endpoint_policy(self) -> EndpointPolicy<'endpoint> {
self.endpoint_policy
}
}