Skip to main content

PartialEq

Trait PartialEq 

1.0.0 (const: unstable) · Source
pub(crate) trait PartialEq<Rhs = Self>
where Rhs: ?Sized,
{ // Required method fn eq(&self, other: &Rhs) -> bool; // Provided method fn ne(&self, other: &Rhs) -> bool { ... } }
Expand description

Trait for comparisons using the equality operator.

Implementing this trait for types provides the == and != operators for those types.

x.eq(y) can also be written x == y, and x.ne(y) can be written x != y. We use the easier-to-read infix notation in the remainder of this documentation.

This trait allows for comparisons using the equality operator, for types that do not have a full equivalence relation. For example, in floating point numbers NaN != NaN, so floating point types implement PartialEq but not Eq. Formally speaking, when Rhs == Self, this trait corresponds to a partial equivalence relation.

Implementations must ensure that eq and ne are consistent with each other:

  • a != b if and only if !(a == b).

The default implementation of ne provides this consistency and is almost always sufficient. It should not be overridden without very good reason.

If PartialOrd or Ord are also implemented for Self and Rhs, their methods must also be consistent with PartialEq (see the documentation of those traits for the exact requirements). It’s easy to accidentally make them disagree by deriving some of the traits and manually implementing others.

The equality relation == must satisfy the following conditions (for all a, b, c of type A, B, C):

  • Symmetry: if A: PartialEq<B> and B: PartialEq<A>, then a == b implies b == a; and

  • Transitivity: if A: PartialEq<B> and B: PartialEq<C> and A: PartialEq<C>, then a == b and b == c implies a == c. This must also work for longer chains, such as when A: PartialEq<B>, B: PartialEq<C>, C: PartialEq<D>, and A: PartialEq<D> all exist.

Note that the B: PartialEq<A> (symmetric) and A: PartialEq<C> (transitive) impls are not forced to exist, but these requirements apply whenever they do exist.

Violating these requirements is a logic error. The behavior resulting from a logic error is not specified, but users of the trait must ensure that such logic errors do not result in undefined behavior. This means that unsafe code must not rely on the correctness of these methods.

§Cross-crate considerations

Upholding the requirements stated above can become tricky when one crate implements PartialEq for a type of another crate (i.e., to allow comparing one of its own types with a type from the standard library). The recommendation is to never implement this trait for a foreign type. In other words, such a crate should do impl PartialEq<ForeignType> for LocalType, but it should not do impl PartialEq<LocalType> for ForeignType.

This avoids the problem of transitive chains that criss-cross crate boundaries: for all local types T, you may assume that no other crate will add impls that allow comparing T == U. In other words, if other crates add impls that allow building longer transitive chains U1 == ... == T == V1 == ..., then all the types that appear to the right of T must be types that the crate defining T already knows about. This rules out transitive chains where downstream crates can add new impls that “stitch together” comparisons of foreign types in ways that violate transitivity.

Not having such foreign impls also avoids forward compatibility issues where one crate adding more PartialEq implementations can cause build failures in downstream crates.

§Derivable

This trait can be used with #[derive]. When derived on structs, two instances are equal if all fields are equal, and not equal if any fields are not equal. When derived on enums, two instances are equal if they are the same variant and all fields are equal.

§How can I implement PartialEq?

An example implementation for a domain in which two books are considered the same book if their ISBN matches, even if the formats differ:

enum BookFormat {
    Paperback,
    Hardback,
    Ebook,
}

struct Book {
    isbn: i32,
    format: BookFormat,
}

impl PartialEq for Book {
    fn eq(&self, other: &Self) -> bool {
        self.isbn == other.isbn
    }
}

let b1 = Book { isbn: 3, format: BookFormat::Paperback };
let b2 = Book { isbn: 3, format: BookFormat::Ebook };
let b3 = Book { isbn: 10, format: BookFormat::Paperback };

assert!(b1 == b2);
assert!(b1 != b3);

§How can I compare two different types?

The type you can compare with is controlled by PartialEq’s type parameter. For example, let’s tweak our previous code a bit:

// The derive implements <BookFormat> == <BookFormat> comparisons
#[derive(PartialEq)]
enum BookFormat {
    Paperback,
    Hardback,
    Ebook,
}

struct Book {
    isbn: i32,
    format: BookFormat,
}

// Implement <Book> == <BookFormat> comparisons
impl PartialEq<BookFormat> for Book {
    fn eq(&self, other: &BookFormat) -> bool {
        self.format == *other
    }
}

// Implement <BookFormat> == <Book> comparisons
impl PartialEq<Book> for BookFormat {
    fn eq(&self, other: &Book) -> bool {
        *self == other.format
    }
}

let b1 = Book { isbn: 3, format: BookFormat::Paperback };

assert!(b1 == BookFormat::Paperback);
assert!(BookFormat::Ebook != b1);

By changing impl PartialEq for Book to impl PartialEq<BookFormat> for Book, we allow BookFormats to be compared with Books.

A comparison like the one above, which ignores some fields of the struct, can be dangerous. It can easily lead to an unintended violation of the requirements for a partial equivalence relation. For example, if we kept the above implementation of PartialEq<Book> for BookFormat and added an implementation of PartialEq<Book> for Book (either via a #[derive] or via the manual implementation from the first example) then the result would violate transitivity:

ⓘ
#[derive(PartialEq)]
enum BookFormat {
    Paperback,
    Hardback,
    Ebook,
}

#[derive(PartialEq)]
struct Book {
    isbn: i32,
    format: BookFormat,
}

impl PartialEq<BookFormat> for Book {
    fn eq(&self, other: &BookFormat) -> bool {
        self.format == *other
    }
}

impl PartialEq<Book> for BookFormat {
    fn eq(&self, other: &Book) -> bool {
        *self == other.format
    }
}

fn main() {
    let b1 = Book { isbn: 1, format: BookFormat::Paperback };
    let b2 = Book { isbn: 2, format: BookFormat::Paperback };

    assert!(b1 == BookFormat::Paperback);
    assert!(BookFormat::Paperback == b2);

    // The following should hold by transitivity but doesn't.
    assert!(b1 == b2); // <-- PANICS
}

§Examples

let x: u32 = 0;
let y: u32 = 1;

assert_eq!(x == y, false);
assert_eq!(x.eq(&y), false);

Required Methods§

1.0.0 (const: unstable) · Source

fn eq(&self, other: &Rhs) -> bool

Tests for self and other values to be equal, and is used by ==.

Provided Methods§

1.0.0 (const: unstable) · Source

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.

Implementors§

Source§

impl PartialEq for tpacket_versions

1.28.0 · Source§

impl PartialEq for libc::prelude::fmt::Alignment

Source§

impl PartialEq for DebugAsHex

Source§

impl PartialEq for Sign

Source§

impl PartialEq for AsciiChar

Source§

impl PartialEq for CharCase

1.0.0 (const: unstable) · Source§

impl PartialEq for core::cmp::Ordering

1.34.0 (const: unstable) · Source§

impl PartialEq for Infallible

1.64.0 · Source§

impl PartialEq for FromBytesWithNulError

Source§

impl PartialEq for Locality

Source§

impl PartialEq for AtomicOrdering

Source§

impl PartialEq for SimdAlign

1.0.0 · Source§

impl PartialEq for ErrorKind

1.7.0 · Source§

impl PartialEq for IpAddr

Source§

impl PartialEq for Ipv6MulticastScope

1.0.0 · Source§

impl PartialEq for SocketAddr

1.0.0 · Source§

impl PartialEq for FpCategory

1.55.0 · Source§

impl PartialEq for IntErrorKind

1.86.0 · Source§

impl PartialEq for GetDisjointMutError

Source§

impl PartialEq for SearchStep

1.0.0 · Source§

impl PartialEq for core::sync::atomic::Ordering

1.0.0 (const: unstable) · Source§

impl PartialEq for bool

1.0.0 (const: unstable) · Source§

impl PartialEq for char

1.0.0 (const: unstable) · Source§

impl PartialEq for f16

1.0.0 (const: unstable) · Source§

impl PartialEq for f32

1.0.0 (const: unstable) · Source§

impl PartialEq for f64

1.0.0 (const: unstable) · Source§

impl PartialEq for f128

1.0.0 (const: unstable) · Source§

impl PartialEq for i8

1.0.0 (const: unstable) · Source§

impl PartialEq for i16

1.0.0 (const: unstable) · Source§

impl PartialEq for i32

1.0.0 (const: unstable) · Source§

impl PartialEq for i64

1.0.0 (const: unstable) · Source§

impl PartialEq for i128

1.0.0 (const: unstable) · Source§

impl PartialEq for isize

Source§

impl PartialEq for !

1.0.0 (const: unstable) · Source§

impl PartialEq for str

1.0.0 (const: unstable) · Source§

impl PartialEq for u8

1.0.0 (const: unstable) · Source§

impl PartialEq for u16

1.0.0 (const: unstable) · Source§

impl PartialEq for u32

1.0.0 (const: unstable) · Source§

impl PartialEq for u64

1.0.0 (const: unstable) · Source§

impl PartialEq for u128

1.0.0 (const: unstable) · Source§

impl PartialEq for ()

1.0.0 (const: unstable) · Source§

impl PartialEq for usize

Source§

impl PartialEq for Dl_info

Source§

impl PartialEq for Elf32_Chdr

Source§

impl PartialEq for Elf32_Ehdr

Source§

impl PartialEq for Elf32_Phdr

Source§

impl PartialEq for Elf32_Shdr

Source§

impl PartialEq for Elf32_Sym

Source§

impl PartialEq for Elf64_Chdr

Source§

impl PartialEq for Elf64_Ehdr

Source§

impl PartialEq for Elf64_Phdr

Source§

impl PartialEq for Elf64_Shdr

Source§

impl PartialEq for Elf64_Sym

Source§

impl PartialEq for __c_anonymous__kernel_fsid_t

Source§

impl PartialEq for __c_anonymous_elf32_rel

Source§

impl PartialEq for __c_anonymous_elf32_rela

Source§

impl PartialEq for __c_anonymous_elf64_rel

Source§

impl PartialEq for __c_anonymous_elf64_rela

Source§

impl PartialEq for __c_anonymous_ifru_map

Source§

impl PartialEq for __c_anonymous_ptrace_syscall_info_entry

Source§

impl PartialEq for __c_anonymous_ptrace_syscall_info_exit

Source§

impl PartialEq for __c_anonymous_ptrace_syscall_info_seccomp

Source§

impl PartialEq for __c_anonymous_sockaddr_can_j1939

Source§

impl PartialEq for __c_anonymous_sockaddr_can_tp

Source§

impl PartialEq for __exit_status

Source§

impl PartialEq for __timeval

Source§

impl PartialEq for _libc_fpstate

Source§

impl PartialEq for _libc_fpxreg

Source§

impl PartialEq for _libc_xmmreg

Source§

impl PartialEq for addrinfo

Source§

impl PartialEq for aiocb

Source§

impl PartialEq for arpd_request

Source§

impl PartialEq for arphdr

Source§

impl PartialEq for arpreq

Source§

impl PartialEq for arpreq_old

Source§

impl PartialEq for bcm_msg_head

Source§

impl PartialEq for bcm_timeval

Source§

impl PartialEq for can_berr_counter

Source§

impl PartialEq for can_bittiming

Source§

impl PartialEq for can_bittiming_const

Source§

impl PartialEq for can_clock

Source§

impl PartialEq for can_ctrlmode

Source§

impl PartialEq for can_device_stats

Source§

impl PartialEq for can_filter

Source§

impl PartialEq for can_frame

Source§

impl PartialEq for canfd_frame

Source§

impl PartialEq for canxl_frame

Source§

impl PartialEq for clone_args

Source§

impl PartialEq for cmsghdr

Source§

impl PartialEq for cpu_set_t

Source§

impl PartialEq for dirent64

Source§

impl PartialEq for dirent

Source§

impl PartialEq for dl_phdr_info

Source§

impl PartialEq for dmabuf_cmsg

Source§

impl PartialEq for dmabuf_token

Source§

impl PartialEq for dqblk

Source§

impl PartialEq for epoll_event

Available on crate feature extra_traits and non-L4Re only.
Source§

impl PartialEq for epoll_params

Source§

impl PartialEq for fanotify_event_info_error

Source§

impl PartialEq for fanotify_event_info_fid

Source§

impl PartialEq for fanotify_event_info_header

Source§

impl PartialEq for fanotify_event_info_pidfd

Source§

impl PartialEq for fanotify_event_metadata

Source§

impl PartialEq for fanotify_response

Source§

impl PartialEq for fanout_args

Source§

impl PartialEq for fd_set

Source§

impl PartialEq for ff_condition_effect

Source§

impl PartialEq for ff_constant_effect

Source§

impl PartialEq for ff_effect

Source§

impl PartialEq for ff_envelope

Source§

impl PartialEq for ff_periodic_effect

Source§

impl PartialEq for ff_ramp_effect

Source§

impl PartialEq for ff_replay

Source§

impl PartialEq for ff_rumble_effect

Source§

impl PartialEq for ff_trigger

Source§

impl PartialEq for file_clone_range

Source§

impl PartialEq for file_handle

Source§

impl PartialEq for flock64

Source§

impl PartialEq for flock

Source§

impl PartialEq for fpos64_t

Source§

impl PartialEq for fpos_t

Source§

impl PartialEq for fsid_t

Source§

impl PartialEq for futex_waitv

Source§

impl PartialEq for genlmsghdr

Source§

impl PartialEq for glob64_t

Source§

impl PartialEq for glob_t

Source§

impl PartialEq for group

Source§

impl PartialEq for group_req

Source§

impl PartialEq for group_source_req

Source§

impl PartialEq for hostent

Source§

impl PartialEq for hwtstamp_config

Source§

impl PartialEq for if_nameindex

Source§

impl PartialEq for ifaddrmsg

Source§

impl PartialEq for ifaddrs

Source§

impl PartialEq for ifinfomsg

Source§

impl PartialEq for in6_addr

Source§

impl PartialEq for in6_ifreq

Source§

impl PartialEq for in6_pktinfo

Source§

impl PartialEq for in6_rtmsg

Source§

impl PartialEq for in_addr

Source§

impl PartialEq for in_pktinfo

Source§

impl PartialEq for inotify_event

Source§

impl PartialEq for input_absinfo

Source§

impl PartialEq for input_event

Source§

impl PartialEq for input_id

Source§

impl PartialEq for input_keymap_entry

Source§

impl PartialEq for input_mask

Source§

impl PartialEq for iocb

Source§

impl PartialEq for iovec

Source§

impl PartialEq for ip_mreq

Source§

impl PartialEq for ip_mreq_source

Source§

impl PartialEq for ip_mreqn

Source§

impl PartialEq for ipc_perm

Source§

impl PartialEq for ipv6_mreq

Source§

impl PartialEq for itimerspec

Source§

impl PartialEq for itimerval

Source§

impl PartialEq for iw_discarded

Source§

impl PartialEq for iw_encode_ext

Source§

impl PartialEq for iw_freq

Source§

impl PartialEq for iw_michaelmicfailure

Source§

impl PartialEq for iw_missed

Source§

impl PartialEq for iw_mlme

Source§

impl PartialEq for iw_param

Source§

impl PartialEq for iw_pmkid_cand

Source§

impl PartialEq for iw_pmksa

Source§

impl PartialEq for iw_point

Source§

impl PartialEq for iw_priv_args

Source§

impl PartialEq for iw_quality

Source§

impl PartialEq for iw_range

Source§

impl PartialEq for iw_scan_req

Source§

impl PartialEq for iw_statistics

Source§

impl PartialEq for iw_thrspy

Source§

impl PartialEq for j1939_filter

Source§

impl PartialEq for lconv

Source§

impl PartialEq for linger

Source§

impl PartialEq for mallinfo2

Source§

impl PartialEq for mallinfo

Source§

impl PartialEq for mbstate_t

Source§

impl PartialEq for mcontext_t

Source§

impl PartialEq for mmsghdr

Source§

impl PartialEq for mnt_ns_info

Source§

impl PartialEq for mntent

Source§

impl PartialEq for mount_attr

Source§

impl PartialEq for mq_attr

Source§

impl PartialEq for msghdr

Source§

impl PartialEq for msginfo

Source§

impl PartialEq for msqid_ds

Source§

impl PartialEq for netent

Source§

impl PartialEq for nl_mmap_hdr

Source§

impl PartialEq for nl_mmap_req

Source§

impl PartialEq for nl_pktinfo

Source§

impl PartialEq for nlattr

Source§

impl PartialEq for nlmsgerr

Source§

impl PartialEq for nlmsghdr

Source§

impl PartialEq for ntptimeval

Source§

impl PartialEq for open_how

Source§

impl PartialEq for option

Source§

impl PartialEq for packet_mreq

Source§

impl PartialEq for passwd

Source§

impl PartialEq for pidfd_info

Source§

impl PartialEq for pollfd

Source§

impl PartialEq for posix_spawn_file_actions_t

Source§

impl PartialEq for posix_spawnattr_t

Source§

impl PartialEq for protoent

Source§

impl PartialEq for pthread_attr_t

Source§

impl PartialEq for pthread_barrier_t

Source§

impl PartialEq for pthread_barrierattr_t

Source§

impl PartialEq for pthread_cond_t

Source§

impl PartialEq for pthread_condattr_t

Source§

impl PartialEq for pthread_mutex_t

Source§

impl PartialEq for pthread_mutexattr_t

Source§

impl PartialEq for pthread_rwlock_t

Source§

impl PartialEq for pthread_rwlockattr_t

Source§

impl PartialEq for ptp_clock_caps

Source§

impl PartialEq for ptp_clock_time

Source§

impl PartialEq for ptp_extts_event

Source§

impl PartialEq for ptp_extts_request

Source§

impl PartialEq for ptp_pin_desc

Source§

impl PartialEq for ptp_sys_offset

Source§

impl PartialEq for ptp_sys_offset_extended

Source§

impl PartialEq for ptp_sys_offset_precise

Source§

impl PartialEq for ptrace_peeksiginfo_args

Source§

impl PartialEq for ptrace_rseq_configuration

Source§

impl PartialEq for ptrace_sud_config

Source§

impl PartialEq for ptrace_syscall_info

Source§

impl PartialEq for regex_t

Source§

impl PartialEq for regmatch_t

Source§

impl PartialEq for rlimit64

Source§

impl PartialEq for rlimit

Source§

impl PartialEq for rtattr

Source§

impl PartialEq for rtentry

Source§

impl PartialEq for rusage

Source§

impl PartialEq for sched_attr

Source§

impl PartialEq for sched_param

Source§

impl PartialEq for sctp_authinfo

Source§

impl PartialEq for sctp_initmsg

Source§

impl PartialEq for sctp_nxtinfo

Source§

impl PartialEq for sctp_prinfo

Source§

impl PartialEq for sctp_rcvinfo

Source§

impl PartialEq for sctp_sndinfo

Source§

impl PartialEq for sctp_sndrcvinfo

Source§

impl PartialEq for seccomp_data

Source§

impl PartialEq for seccomp_notif

Source§

impl PartialEq for seccomp_notif_addfd

Source§

impl PartialEq for seccomp_notif_resp

Source§

impl PartialEq for seccomp_notif_sizes

Source§

impl PartialEq for sem_t

Source§

impl PartialEq for sembuf

Source§

impl PartialEq for semid_ds

Source§

impl PartialEq for seminfo

Source§

impl PartialEq for servent

Source§

impl PartialEq for shmid_ds

Source§

impl PartialEq for sigaction

Source§

impl PartialEq for sigevent

Available on crate feature extra_traits and non-L4Re only.
Source§

impl PartialEq for siginfo_t

Available on crate features extra_traits only.
Source§

impl PartialEq for signalfd_siginfo

Source§

impl PartialEq for sigset_t

Source§

impl PartialEq for sigval

Source§

impl PartialEq for sock_extended_err

Source§

impl PartialEq for sock_filter

Source§

impl PartialEq for sock_fprog

Source§

impl PartialEq for sockaddr

Source§

impl PartialEq for sockaddr_alg

Source§

impl PartialEq for sockaddr_in6

Source§

impl PartialEq for sockaddr_in

Source§

impl PartialEq for sockaddr_iucv

Source§

impl PartialEq for sockaddr_ll

Source§

impl PartialEq for sockaddr_nl

Source§

impl PartialEq for sockaddr_pkt

Source§

impl PartialEq for sockaddr_storage

Source§

impl PartialEq for sockaddr_un

Source§

impl PartialEq for sockaddr_vm

Source§

impl PartialEq for sockaddr_xdp

Source§

impl PartialEq for spwd

Source§

impl PartialEq for stack_t

Source§

impl PartialEq for stat64

Source§

impl PartialEq for stat

Source§

impl PartialEq for statfs64

Source§

impl PartialEq for statfs

Source§

impl PartialEq for statvfs64

Source§

impl PartialEq for statvfs

Source§

impl PartialEq for statx

Source§

impl PartialEq for statx_timestamp

Source§

impl PartialEq for sysinfo

Source§

impl PartialEq for tcp_info

Source§

impl PartialEq for termios2

Source§

impl PartialEq for termios

Source§

impl PartialEq for timespec

Source§

impl PartialEq for timeval

Source§

impl PartialEq for timex

Source§

impl PartialEq for tls12_crypto_info_aes_ccm_128

Source§

impl PartialEq for tls12_crypto_info_aes_gcm_128

Source§

impl PartialEq for tls12_crypto_info_aes_gcm_256

Source§

impl PartialEq for tls12_crypto_info_aria_gcm_128

Source§

impl PartialEq for tls12_crypto_info_aria_gcm_256

Source§

impl PartialEq for tls12_crypto_info_chacha20_poly1305

Source§

impl PartialEq for tls12_crypto_info_sm4_ccm

Source§

impl PartialEq for tls12_crypto_info_sm4_gcm

Source§

impl PartialEq for tls_crypto_info

Source§

impl PartialEq for tm

Source§

impl PartialEq for tms

Source§

impl PartialEq for tpacket2_hdr

Source§

impl PartialEq for tpacket3_hdr

Source§

impl PartialEq for tpacket_auxdata

Source§

impl PartialEq for tpacket_bd_ts

Source§

impl PartialEq for tpacket_hdr

Source§

impl PartialEq for tpacket_hdr_v1

Source§

impl PartialEq for tpacket_hdr_variant1

Source§

impl PartialEq for tpacket_req3

Source§

impl PartialEq for tpacket_req

Source§

impl PartialEq for tpacket_rollover_stats

Source§

impl PartialEq for tpacket_stats

Source§

impl PartialEq for tpacket_stats_v3

Source§

impl PartialEq for ucontext_t

Source§

impl PartialEq for ucred

Source§

impl PartialEq for uinput_abs_setup

Source§

impl PartialEq for uinput_ff_erase

Source§

impl PartialEq for uinput_ff_upload

Source§

impl PartialEq for uinput_setup

Source§

impl PartialEq for uinput_user_dev

Source§

impl PartialEq for user

Source§

impl PartialEq for user_fpregs_struct

Source§

impl PartialEq for user_regs_struct

Source§

impl PartialEq for utimbuf

Source§

impl PartialEq for utmpx

Source§

impl PartialEq for utsname

Source§

impl PartialEq for winsize

Source§

impl PartialEq for xdp_desc

Source§

impl PartialEq for xdp_mmap_offsets

Source§

impl PartialEq for xdp_mmap_offsets_v1

Source§

impl PartialEq for xdp_options

Source§

impl PartialEq for xdp_ring_offset

Source§

impl PartialEq for xdp_ring_offset_v1

Source§

impl PartialEq for xdp_statistics

Source§

impl PartialEq for xdp_statistics_v1

Source§

impl PartialEq for xdp_umem_reg

Source§

impl PartialEq for xdp_umem_reg_v1

Source§

impl PartialEq for xsk_tx_metadata_completion

Source§

impl PartialEq for xsk_tx_metadata_request

1.0.0 · Source§

impl PartialEq for Error

Source§

impl PartialEq for FormattingOptions

1.28.0 · Source§

impl PartialEq for Layout

1.50.0 · Source§

impl PartialEq for LayoutError

Source§

impl PartialEq for AllocError

1.0.0 (const: unstable) · Source§

impl PartialEq for TypeId

Source§

impl PartialEq for ByteStr

1.34.0 · Source§

impl PartialEq for CharTryFromError

1.20.0 · Source§

impl PartialEq for ParseCharError

1.9.0 · Source§

impl PartialEq for DecodeUtf16Error

1.59.0 · Source§

impl PartialEq for TryFromCharError

1.27.0 · Source§

impl PartialEq for CpuidResult

1.64.0 · Source§

impl PartialEq for CStr

1.69.0 · Source§

impl PartialEq for FromBytesUntilNulError

1.33.0 · Source§

impl PartialEq for PhantomPinned

1.0.0 (const: unstable) · Source§

impl PartialEq for Ipv4Addr

1.0.0 (const: unstable) · Source§

impl PartialEq for Ipv6Addr

1.0.0 · Source§

impl PartialEq for AddrParseError

1.0.0 · Source§

impl PartialEq for SocketAddrV4

1.0.0 · Source§

impl PartialEq for SocketAddrV6

1.0.0 · Source§

impl PartialEq for ParseIntError

1.34.0 · Source§

impl PartialEq for TryFromIntError

1.0.0 · Source§

impl PartialEq for ParseFloatError

1.0.0 (const: unstable) · Source§

impl PartialEq for RangeFull

1.0.0 · Source§

impl PartialEq for ParseBoolError

1.0.0 · Source§

impl PartialEq for Utf8Error

1.36.0 · Source§

impl PartialEq for RawWaker

1.36.0 · Source§

impl PartialEq for RawWakerVTable

1.3.0 · Source§

impl PartialEq for Duration

1.66.0 · Source§

impl PartialEq for TryFromFloatSecsError

Source§

impl PartialEq for libc::prelude::mem::Alignment

Source§

impl PartialEq for Assume

1.10.0 · Source§

impl PartialEq for Location<'_>

Source§

impl PartialEq for __c_anonymous_ptrace_syscall_info_data

Available on crate features extra_traits only.
Source§

impl PartialEq<&str> for ByteStr

1.90.0 · Source§

impl PartialEq<&CStr> for CStr

Source§

impl PartialEq<&[u8]> for ByteStr

1.16.0 · Source§

impl PartialEq<IpAddr> for Ipv4Addr

1.16.0 · Source§

impl PartialEq<IpAddr> for Ipv6Addr

Source§

impl PartialEq<str> for ByteStr

Source§

impl PartialEq<ByteStr> for &str

Source§

impl PartialEq<ByteStr> for &[u8]

Source§

impl PartialEq<ByteStr> for str

Source§

impl PartialEq<ByteStr> for [u8]

1.16.0 · Source§

impl PartialEq<Ipv4Addr> for IpAddr

1.16.0 · Source§

impl PartialEq<Ipv6Addr> for IpAddr

Source§

impl PartialEq<[u8]> for ByteStr

Source§

impl<'a> PartialEq for Utf8Pattern<'a>

Source§

impl<'a> PartialEq for PhantomContravariantLifetime<'a>

Source§

impl<'a> PartialEq for PhantomCovariantLifetime<'a>

Source§

impl<'a> PartialEq for PhantomInvariantLifetime<'a>

1.79.0 · Source§

impl<'a> PartialEq for Utf8Chunk<'a>

1.0.0 (const: unstable) · Source§

impl<A, B> PartialEq<&B> for &A
where A: PartialEq<B> + ?Sized, B: ?Sized,

1.0.0 (const: unstable) · Source§

impl<A, B> PartialEq<&B> for &mut A
where A: PartialEq<B> + ?Sized, B: ?Sized,

1.0.0 (const: unstable) · Source§

impl<A, B> PartialEq<&mut B> for &A
where A: PartialEq<B> + ?Sized, B: ?Sized,

1.0.0 (const: unstable) · Source§

impl<A, B> PartialEq<&mut B> for &mut A
where A: PartialEq<B> + ?Sized, B: ?Sized,

1.55.0 (const: unstable) · Source§

impl<B, C> PartialEq for ControlFlow<B, C>
where B: PartialEq, C: PartialEq,

Source§

impl<Dyn> PartialEq for DynMetadata<Dyn>
where Dyn: ?Sized,

1.4.0 · Source§

impl<F> PartialEq for F
where F: FnPtr,

1.29.0 · Source§

impl<H> PartialEq for BuildHasherDefault<H>

1.0.0 (const: unstable) · Source§

impl<Idx> PartialEq for core::ops::range::Range<Idx>
where Idx: PartialEq,

1.0.0 (const: unstable) · Source§

impl<Idx> PartialEq for core::ops::range::RangeFrom<Idx>
where Idx: PartialEq,

1.26.0 (const: unstable) · Source§

impl<Idx> PartialEq for core::ops::range::RangeInclusive<Idx>
where Idx: PartialEq,

1.0.0 (const: unstable) · Source§

impl<Idx> PartialEq for RangeTo<Idx>
where Idx: PartialEq,

1.26.0 · Source§

impl<Idx> PartialEq for core::ops::range::RangeToInclusive<Idx>
where Idx: PartialEq,

1.96.0 (const: unstable) · Source§

impl<Idx> PartialEq for core::range::Range<Idx>
where Idx: PartialEq,

1.96.0 (const: unstable) · Source§

impl<Idx> PartialEq for core::range::RangeFrom<Idx>
where Idx: PartialEq,

1.95.0 · Source§

impl<Idx> PartialEq for core::range::RangeInclusive<Idx>
where Idx: PartialEq,

1.96.0 · Source§

impl<Idx> PartialEq for core::range::RangeToInclusive<Idx>
where Idx: PartialEq,

1.41.0 · Source§

impl<Ptr, Q> PartialEq<Pin<Q>> for Pin<Ptr>
where Ptr: Deref, Q: Deref, <Ptr as Deref>::Target: PartialEq<<Q as Deref>::Target>,

1.0.0 (const: unstable) · Source§

impl<T> PartialEq for Option<T>
where T: PartialEq,

1.17.0 (const: unstable) · Source§

impl<T> PartialEq for Bound<T>
where T: PartialEq,

1.36.0 · Source§

impl<T> PartialEq for Poll<T>
where T: PartialEq,

1.0.0 · Source§

impl<T> PartialEq for *const T
where T: ?Sized,

Pointer equality is by address, as produced by the <*const T>::addr method.

1.0.0 · Source§

impl<T> PartialEq for *mut T
where T: ?Sized,

Pointer equality is by address, as produced by the <*mut T>::addr method.

1.0.0 (const: unstable) · Source§

impl<T> PartialEq for (T₁, T₂, …, Tₙ)
where T: PartialEq,

This trait is implemented for tuples up to twelve items long.

1.70.0 · Source§

impl<T> PartialEq for OnceCell<T>
where T: PartialEq,

1.0.0 · Source§

impl<T> PartialEq for Cell<T>
where T: PartialEq + Copy,

1.0.0 · Source§

impl<T> PartialEq for RefCell<T>
where T: PartialEq + ?Sized,

1.19.0 (const: unstable) · Source§

impl<T> PartialEq for Reverse<T>
where T: PartialEq,

1.0.0 · Source§

impl<T> PartialEq for Cursor<T>
where T: PartialEq,

1.0.0 · Source§

impl<T> PartialEq for PhantomData<T>
where T: ?Sized,

Source§

impl<T> PartialEq for PhantomContravariant<T>
where T: ?Sized,

Source§

impl<T> PartialEq for PhantomCovariant<T>
where T: ?Sized,

Source§

impl<T> PartialEq for PhantomInvariant<T>
where T: ?Sized,

1.28.0 (const: unstable) · Source§

impl<T> PartialEq for NonZero<T>

1.74.0 · Source§

impl<T> PartialEq for Saturating<T>
where T: PartialEq,

1.0.0 · Source§

impl<T> PartialEq for Wrapping<T>
where T: PartialEq,

1.21.0 · Source§

impl<T> PartialEq for Discriminant<T>

1.20.0 · Source§

impl<T> PartialEq for ManuallyDrop<T>
where T: PartialEq + ?Sized,

Source§

impl<T> PartialEq for TraitImpl<T>
where T: PartialEq + ?Sized,

1.25.0 · Source§

impl<T> PartialEq for NonNull<T>
where T: ?Sized,

1.0.0 (const: unstable) · Source§

impl<T, E> PartialEq for Result<T, E>
where T: PartialEq, E: PartialEq,

1.0.0 (const: unstable) · Source§

impl<T, U> PartialEq<[U]> for [T]
where T: PartialEq<U>,

Source§

impl<T, U> PartialEq<SyncView<U>> for SyncView<T>
where T: Sync + PartialEq<U> + ?Sized, U: Sync + ?Sized,

1.0.0 (const: unstable) · Source§

impl<T, U, const N: usize> PartialEq<&[U]> for [T; N]
where T: PartialEq<U>,

1.0.0 (const: unstable) · Source§

impl<T, U, const N: usize> PartialEq<&mut [U]> for [T; N]
where T: PartialEq<U>,

1.0.0 (const: unstable) · Source§

impl<T, U, const N: usize> PartialEq<[U; N]> for &[T]
where T: PartialEq<U>,

1.0.0 (const: unstable) · Source§

impl<T, U, const N: usize> PartialEq<[U; N]> for &mut [T]
where T: PartialEq<U>,

1.0.0 (const: unstable) · Source§

impl<T, U, const N: usize> PartialEq<[U; N]> for [T; N]
where T: PartialEq<U>,

1.0.0 (const: unstable) · Source§

impl<T, U, const N: usize> PartialEq<[U; N]> for [T]
where T: PartialEq<U>,

1.0.0 (const: unstable) · Source§

impl<T, U, const N: usize> PartialEq<[U]> for [T; N]
where T: PartialEq<U>,

Source§

impl<T, const N: usize> PartialEq for Mask<T, N>

Source§

impl<T, const N: usize> PartialEq for Simd<T, N>

Source§

impl<T, const VARIANT: u32, const FIELD: u32> PartialEq for FieldRepresentingType<T, VARIANT, FIELD>
where T: ?Sized,

Source§

impl<T: Copy> PartialEq for Padding<T>

Available on crate feature extra_traits only.

Padding fields are all equal, regardless of what is inside them, so they do not affect anything.

Source§

impl<Y, R> PartialEq for CoroutineState<Y, R>
where Y: PartialEq, R: PartialEq,

Source§

impl<const N: usize> PartialEq<&[u8; N]> for ByteStr

Source§

impl<const N: usize> PartialEq<ByteStr> for &[u8; N]

Source§

impl<const N: usize> PartialEq<ByteStr> for [u8; N]

Source§

impl<const N: usize> PartialEq<[u8; N]> for ByteStr