pub struct CompatibilityAdapter { /* private fields */ }
Expand description
Compatibility adapter for handling different protocol versions
Implementations§
Source§impl CompatibilityAdapter
impl CompatibilityAdapter
Sourcepub fn new(version_manager: VersionManager) -> Self
pub fn new(version_manager: VersionManager) -> Self
Create a new compatibility adapter
Sourcepub fn transform_message(
&self,
message: &Message,
target_version: &ProtocolVersion,
) -> Result<Message, CompatibilityError>
pub fn transform_message( &self, message: &Message, target_version: &ProtocolVersion, ) -> Result<Message, CompatibilityError>
Transform message to target version
Sourcepub fn is_feature_available(
&self,
version: &ProtocolVersion,
feature: &str,
) -> bool
pub fn is_feature_available( &self, version: &ProtocolVersion, feature: &str, ) -> bool
Check if feature is available in version
Sourcepub fn get_supported_features(&self, version: &ProtocolVersion) -> Vec<String>
pub fn get_supported_features(&self, version: &ProtocolVersion) -> Vec<String>
Get supported features for version
Sourcepub fn to_legacy_format(
&self,
message: &Message,
) -> Result<LegacyMessage, CompatibilityError>
pub fn to_legacy_format( &self, message: &Message, ) -> Result<LegacyMessage, CompatibilityError>
Convert modern message to legacy format
Sourcepub fn from_legacy_format(
&self,
legacy: &LegacyMessage,
) -> Result<Message, CompatibilityError>
pub fn from_legacy_format( &self, legacy: &LegacyMessage, ) -> Result<Message, CompatibilityError>
Convert legacy message to modern format
Sourcepub fn add_transformer(
&mut self,
from_version: ProtocolVersion,
to_version: ProtocolVersion,
transformer: Box<dyn MessageTransformer>,
)
pub fn add_transformer( &mut self, from_version: ProtocolVersion, to_version: ProtocolVersion, transformer: Box<dyn MessageTransformer>, )
Add custom transformer
Sourcepub fn check_compatibility(
&self,
version1: &ProtocolVersion,
version2: &ProtocolVersion,
) -> Result<Vec<String>, CompatibilityError>
pub fn check_compatibility( &self, version1: &ProtocolVersion, version2: &ProtocolVersion, ) -> Result<Vec<String>, CompatibilityError>
Check compatibility between two versions
Auto Trait Implementations§
impl Freeze for CompatibilityAdapter
impl !RefUnwindSafe for CompatibilityAdapter
impl Send for CompatibilityAdapter
impl Sync for CompatibilityAdapter
impl Unpin for CompatibilityAdapter
impl !UnwindSafe for CompatibilityAdapter
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more