Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bench list of strings #296

Merged
merged 8 commits into from
Dec 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions fe2o3-amqp-types/src/definitions/error_cond.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,46 +53,6 @@ impl ser::Serialize for ErrorCondition {
}
}

// struct Visitor {}

// impl<'de> de::Visitor<'de> for Visitor {
// type Value = ErrorCondition;

// fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
// formatter.write_str("enum ErrorCondition")
// }

// fn visit_string<E>(self, v: String) -> Result<Self::Value, E>
// where
// E: de::Error,
// {
// self.visit_str(v.as_str())
// }

// fn visit_str<E>(self, v: &str) -> Result<Self::Value, E>
// where
// E: de::Error,
// {
// let v = match AmqpError::try_from(v) {
// Ok(val) => return Ok(ErrorCondition::AmqpError(val)),
// Err(e) => e,
// };
// let v = match ConnectionError::try_from(v) {
// Ok(val) => return Ok(ErrorCondition::ConnectionError(val)),
// Err(e) => e,
// };
// let v = match SessionError::try_from(v) {
// Ok(val) => return Ok(ErrorCondition::SessionError(val)),
// Err(e) => e,
// };
// let v = match LinkError::try_from(v) {
// Ok(val) => return Ok(ErrorCondition::LinkError(val)),
// Err(e) => e,
// };
// Ok(ErrorCondition::Custom(Symbol::from(v)))
// }
// }

impl<'de> de::Deserialize<'de> for ErrorCondition {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where
Expand Down
2 changes: 1 addition & 1 deletion fe2o3-amqp-types/src/definitions/rcv_settle_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl ser::Serialize for ReceiverSettleMode {

struct Visitor {}

impl<'de> de::Visitor<'de> for Visitor {
impl de::Visitor<'_> for Visitor {
type Value = ReceiverSettleMode;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion fe2o3-amqp-types/src/definitions/role.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl ser::Serialize for Role {

struct Visitor {}

impl<'de> de::Visitor<'de> for Visitor {
impl de::Visitor<'_> for Visitor {
type Value = Role;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion fe2o3-amqp-types/src/definitions/snd_settle_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ impl ser::Serialize for SenderSettleMode {

struct Visitor {}

impl<'de> de::Visitor<'de> for Visitor {
impl de::Visitor<'_> for Visitor {
type Value = SenderSettleMode;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
12 changes: 6 additions & 6 deletions fe2o3-amqp-types/src/messaging/body_section.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ where
///
/// impl FromEmptyBody for Foo {}
///
/// impl<'de> FromBody<'de> for Foo {
/// impl FromBody<'_> for Foo {
/// type Body = AmqpValue<Self>;
///
/// fn from_body(body: Self::Body) -> Self {
Expand Down Expand Up @@ -304,7 +304,7 @@ impl IntoBody for Value {
}
}

impl<'de> FromBody<'de> for Value {
impl FromBody<'_> for Value {
type Body = AmqpValue<Value>;

fn from_body(deserializable: Self::Body) -> Self {
Expand All @@ -328,7 +328,7 @@ impl IntoBody for LazyValue {
}
}

impl<'de> FromBody<'de> for LazyValue {
impl FromBody<'_> for LazyValue {
type Body = AmqpValue<Self>;

fn from_body(deserializable: Self::Body) -> Self {
Expand Down Expand Up @@ -398,15 +398,15 @@ impl<'a> IntoBody for &'a str {
}
}

impl<'a> IntoBody for Cow<'a, str> {
impl IntoBody for Cow<'_, str> {
type Body = AmqpValue<Self>;

fn into_body(self) -> Self::Body {
AmqpValue(self)
}
}

impl<'a> IntoBody for SymbolRef<'a> {
impl IntoBody for SymbolRef<'_> {
type Body = AmqpValue<Self>;

fn into_body(self) -> Self::Body {
Expand Down Expand Up @@ -489,7 +489,7 @@ macro_rules! impl_from_deserializable_or_empty_body {
};

(AmqpValue, $type:ty) => {
impl<'de> FromBody<'de> for $type {
impl FromBody<'_> for $type {
type Body = AmqpValue<Self>;

fn from_body(deserializable: Self::Body) -> Self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ enum Field {

struct FieldVisitor {}

impl<'de> de::Visitor<'de> for FieldVisitor {
impl de::Visitor<'_> for FieldVisitor {
type Value = Field;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ enum Field {

struct FieldVisitor {}

impl<'de> de::Visitor<'de> for FieldVisitor {
impl de::Visitor<'_> for FieldVisitor {
type Value = Field;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion fe2o3-amqp-types/src/messaging/format/amqp_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ mod tests {

impl FromEmptyBody for TestExample {}

impl<'de> FromBody<'de> for TestExample {
impl FromBody<'_> for TestExample {
type Body = AmqpValue<Self>;

fn from_body(deserializable: Self::Body) -> Self {
Expand Down
16 changes: 8 additions & 8 deletions fe2o3-amqp-types/src/messaging/format/annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ enum Field {

struct FieldVisitor {}

impl<'de> de::Visitor<'de> for FieldVisitor {
impl de::Visitor<'_> for FieldVisitor {
type Value = Field;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down Expand Up @@ -199,7 +199,7 @@ pub trait AnnotationKey {
fn key(&self) -> BorrowedKey<'_>;
}

impl<'a> AnnotationKey for BorrowedKey<'a> {
impl AnnotationKey for BorrowedKey<'_> {
fn key(&self) -> BorrowedKey<'_> {
self.clone()
}
Expand Down Expand Up @@ -244,7 +244,7 @@ impl AnnotationKey for Symbol {
}
}

impl<'a> AnnotationKey for SymbolRef<'a> {
impl AnnotationKey for SymbolRef<'_> {
fn key(&self) -> BorrowedKey<'_> {
BorrowedKey::Symbol(SymbolRef(self.0))
}
Expand All @@ -256,15 +256,15 @@ impl<'a> Borrow<dyn AnnotationKey + 'a> for OwnedKey {
}
}

impl<'a> PartialEq for (dyn AnnotationKey + 'a) {
impl PartialEq for (dyn AnnotationKey + '_) {
fn eq(&self, other: &Self) -> bool {
self.key().eq(&other.key())
}
}

impl<'a> Eq for (dyn AnnotationKey + 'a) {}
impl Eq for (dyn AnnotationKey + '_) {}

impl<'a> PartialOrd for (dyn AnnotationKey + 'a) {
impl PartialOrd for (dyn AnnotationKey + '_) {
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
// self.key().partial_cmp(&other.key())

Expand All @@ -277,13 +277,13 @@ impl<'a> PartialOrd for (dyn AnnotationKey + 'a) {
}
}

impl<'a> Ord for (dyn AnnotationKey + 'a) {
impl Ord for (dyn AnnotationKey + '_) {
fn cmp(&self, other: &Self) -> std::cmp::Ordering {
self.key().cmp(&other.key())
}
}

impl<'a> Hash for (dyn AnnotationKey + 'a) {
impl Hash for (dyn AnnotationKey + '_) {
fn hash<H: Hasher>(&self, state: &mut H) {
self.key().hash(state)
}
Expand Down
8 changes: 4 additions & 4 deletions fe2o3-amqp-types/src/messaging/format/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl BodySection for Data {}

impl SerializableBody for Data {}

impl<'de> DeserializableBody<'de> for Data {}
impl DeserializableBody<'_> for Data {}

impl IntoBody for Data {
type Body = Self;
Expand All @@ -110,7 +110,7 @@ impl IntoBody for Data {
}
}

impl<'de> FromBody<'de> for Data {
impl FromBody<'_> for Data {
type Body = Data;

fn from_body(deserializable: Self::Body) -> Self {
Expand All @@ -128,7 +128,7 @@ impl BodySection for Batch<Data> {}

impl SerializableBody for Batch<Data> {}

impl<'de> DeserializableBody<'de> for Batch<Data> {}
impl DeserializableBody<'_> for Batch<Data> {}

impl IntoBody for Batch<Data> {
type Body = Self;
Expand All @@ -138,7 +138,7 @@ impl IntoBody for Batch<Data> {
}
}

impl<'de> FromBody<'de> for Batch<Data> {
impl FromBody<'_> for Batch<Data> {
type Body = Batch<Data>;

fn from_body(deserializable: Self::Body) -> Self {
Expand Down
2 changes: 1 addition & 1 deletion fe2o3-amqp-types/src/messaging/format/message_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ enum Field {

struct FieldVisitor {}

impl<'de> de::Visitor<'de> for FieldVisitor {
impl de::Visitor<'_> for FieldVisitor {
type Value = Field;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion fe2o3-amqp-types/src/messaging/lifetime_policy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ enum Field {

struct FieldVisitor {}

impl<'de> de::Visitor<'de> for FieldVisitor {
impl de::Visitor<'_> for FieldVisitor {
type Value = Field;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion fe2o3-amqp-types/src/messaging/message/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ enum Field {
Value,
}

impl<'de> de::Visitor<'de> for FieldVisitor {
impl de::Visitor<'_> for FieldVisitor {
type Value = Field;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion fe2o3-amqp-types/src/messaging/message/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ enum Field {

struct FieldVisitor {}

impl<'de> de::Visitor<'de> for FieldVisitor {
impl de::Visitor<'_> for FieldVisitor {
type Value = Field;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion fe2o3-amqp-types/src/messaging/target.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ mod target_archetype_serde_impl {

struct FieldVisitor {}

impl<'de> de::Visitor<'de> for FieldVisitor {
impl de::Visitor<'_> for FieldVisitor {
type Value = Field;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion fe2o3-amqp-types/src/performatives/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ mod performative_impl {

struct FieldVisitor {}

impl<'de> de::Visitor<'de> for FieldVisitor {
impl de::Visitor<'_> for FieldVisitor {
type Value = Field;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
6 changes: 0 additions & 6 deletions fe2o3-amqp-types/src/primitives/simple_value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,6 @@ pub enum SimpleValue {
/// label = "64-bit two’s-complement integer representing milliseconds since the unix epoch"
Timestamp(Timestamp),

/// An absolute point in time
///
/// encoding name = "ms64", code = 0x83,
/// category = fixed, width = 8
/// label = "64-bit two’s-complement integer representing milliseconds since the unix epoch"

/// A universally unique identifier as defined by RFC-4122 in section 4.1.2
///
/// encoding code = 0x98,
Expand Down
2 changes: 1 addition & 1 deletion fe2o3-amqp-types/src/sasl/mechanisms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ impl<'de> serde_amqp::serde::de::Deserialize<'de> for SaslMechanisms {
sasl_server_mechanisms,
}
struct FieldVisitor {}
impl<'de> serde_amqp::serde::de::Visitor<'de> for FieldVisitor {
impl de::Visitor<'_> for FieldVisitor {
type Value = Field;
fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
formatter.write_str("field identifier")
Expand Down
2 changes: 1 addition & 1 deletion fe2o3-amqp/src/frames/sasl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ enum Field {

struct FieldVisitor {}

impl<'de> de::Visitor<'de> for FieldVisitor {
impl de::Visitor<'_> for FieldVisitor {
type Value = Field;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
2 changes: 1 addition & 1 deletion fe2o3-amqp/src/link/receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ impl Receiver {
/// a: i32
/// }
///
/// impl<'de> FromBody<'de> for Foo {
/// impl FromBody<'_> for Foo {
/// type Body = AmqpValue<Foo>;
///
/// fn from_body(body: Self::Body) -> Self {
Expand Down
4 changes: 2 additions & 2 deletions fe2o3-amqp/src/transaction/control_link_frame.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl IntoBody for ControlMessageBody {

impl FromEmptyBody for ControlMessageBody {}

impl<'de> FromBody<'de> for ControlMessageBody {
impl FromBody<'_> for ControlMessageBody {
type Body = AmqpValue<Self>;

fn from_body(deserializable: Self::Body) -> Self {
Expand All @@ -50,7 +50,7 @@ enum Field {

struct FieldVisitor {}

impl<'de> de::Visitor<'de> for FieldVisitor {
impl de::Visitor<'_> for FieldVisitor {
type Value = Field;

fn expecting(&self, formatter: &mut std::fmt::Formatter) -> std::fmt::Result {
Expand Down
Loading
Loading