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

impls for Ipv4Addr/Ipv6Addr #694

Closed
wants to merge 1 commit into from
Closed
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
17 changes: 17 additions & 0 deletions src/de/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use core::{
cell::{Cell, RefCell},
cmp::Reverse,
net::{Ipv4Addr, Ipv6Addr},

Check failure on line 13 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Check (beta)

use of unstable library feature 'ip_in_core'

Check failure on line 13 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Check (beta)

use of unstable library feature 'ip_in_core'

Check failure on line 13 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

use of unstable library feature 'ip_in_core'

Check failure on line 13 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

use of unstable library feature 'ip_in_core'

Check failure on line 13 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Lints

use of unstable library feature 'ip_in_core'

Check failure on line 13 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Lints

use of unstable library feature 'ip_in_core'

Check failure on line 13 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Compatibility

use of unstable library feature 'ip_in_core'

Check failure on line 13 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Compatibility

use of unstable library feature 'ip_in_core'
num::{
NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize, NonZeroU128,
NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize, Wrapping,
Expand Down Expand Up @@ -670,6 +671,22 @@
}
impl_borrow_decode!(Duration);

impl Decode for Ipv4Addr {

Check failure on line 674 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Check (beta)

conflicting implementations of trait `Decode` for type `Ipv4Addr`

Check failure on line 674 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

conflicting implementations of trait `Decode` for type `Ipv4Addr`

Check failure on line 674 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Check (nightly)

conflicting implementations of trait `Decode` for type `Ipv4Addr`

Check failure on line 674 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Lints

conflicting implementations of trait `de::Decode` for type `core::net::Ipv4Addr`

Check failure on line 674 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Compatibility

conflicting implementations of trait `Decode` for type `Ipv4Addr`
fn decode<D: Decoder>(decoder: &mut D) -> Result<Self, DecodeError> {
let octets: [u8; 4] = Decode::decode(decoder)?;
Ok(Ipv4Addr::from(octets))
}
}
impl_borrow_decode!(Ipv4Addr);

impl Decode for Ipv6Addr {

Check failure on line 682 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Check (beta)

conflicting implementations of trait `Decode` for type `Ipv6Addr`

Check failure on line 682 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

conflicting implementations of trait `Decode` for type `Ipv6Addr`

Check failure on line 682 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Check (nightly)

conflicting implementations of trait `Decode` for type `Ipv6Addr`

Check failure on line 682 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Lints

conflicting implementations of trait `de::Decode` for type `core::net::Ipv6Addr`

Check failure on line 682 in src/de/impls.rs

View workflow job for this annotation

GitHub Actions / Compatibility

conflicting implementations of trait `Decode` for type `Ipv6Addr`
fn decode<D: Decoder>(decoder: &mut D) -> Result<Self, DecodeError> {
let octets: [u8; 16] = Decode::decode(decoder)?;
Ok(Ipv6Addr::from(octets))
}
}
impl_borrow_decode!(Ipv6Addr);

impl<T> Decode for Range<T>
where
T: Decode,
Expand Down
17 changes: 16 additions & 1 deletion src/enc/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
config::{Endianness, IntEncoding, InternalEndianConfig, InternalIntEncodingConfig},
error::EncodeError,
};
use core::cmp::Reverse;
use core::{
cell::{Cell, RefCell},
cmp::Reverse,
marker::PhantomData,
net::{Ipv4Addr, Ipv6Addr},

Check failure on line 10 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Check (beta)

use of unstable library feature 'ip_in_core'

Check failure on line 10 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Check (beta)

use of unstable library feature 'ip_in_core'

Check failure on line 10 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

use of unstable library feature 'ip_in_core'

Check failure on line 10 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

use of unstable library feature 'ip_in_core'

Check failure on line 10 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Lints

use of unstable library feature 'ip_in_core'

Check failure on line 10 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Lints

use of unstable library feature 'ip_in_core'

Check failure on line 10 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Compatibility

use of unstable library feature 'ip_in_core'

Check failure on line 10 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Compatibility

use of unstable library feature 'ip_in_core'
num::{
NonZeroI128, NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize, NonZeroU128,
NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize, Wrapping,
Expand Down Expand Up @@ -437,6 +438,20 @@
}
}

impl Encode for Ipv4Addr {

Check failure on line 441 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Check (beta)

conflicting implementations of trait `Encode` for type `Ipv4Addr`

Check failure on line 441 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

conflicting implementations of trait `Encode` for type `Ipv4Addr`

Check failure on line 441 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Check (nightly)

conflicting implementations of trait `Encode` for type `Ipv4Addr`

Check failure on line 441 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Lints

conflicting implementations of trait `enc::Encode` for type `core::net::Ipv4Addr`

Check failure on line 441 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Compatibility

conflicting implementations of trait `Encode` for type `Ipv4Addr`
fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), EncodeError> {
self.octets().encode(encoder)?;
Ok(())
}
}

impl Encode for Ipv6Addr {

Check failure on line 448 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Check (beta)

conflicting implementations of trait `Encode` for type `Ipv6Addr`

Check failure on line 448 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Check (stable)

conflicting implementations of trait `Encode` for type `Ipv6Addr`

Check failure on line 448 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Check (nightly)

conflicting implementations of trait `Encode` for type `Ipv6Addr`

Check failure on line 448 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Lints

conflicting implementations of trait `enc::Encode` for type `core::net::Ipv6Addr`

Check failure on line 448 in src/enc/impls.rs

View workflow job for this annotation

GitHub Actions / Compatibility

conflicting implementations of trait `Encode` for type `Ipv6Addr`
fn encode<E: Encoder>(&self, encoder: &mut E) -> Result<(), EncodeError> {
self.octets().encode(encoder)?;
Ok(())
}
}

impl<T> Encode for Range<T>
where
T: Encode,
Expand Down
Loading