# Function core::ptr::eq 1.17.0[−][src]

    pub fn eq<T: ?Sized>(a: *const T, b: *const T) -> bool

Compare raw pointers for equality.

This is the same as using the `==` operator, but less generic: the arguments have to be `*const T` raw pointers, not anything that implements `PartialEq`.

This can be used to compare `&T` references (which coerce to `*const T` implicitly) by their address rather than comparing the values they point to (which is what the `PartialEq for &T` implementation does).

# Examples

    use std::ptr;

    let five = 5;
    let other_five = 5;
    let five_ref = &five;
    let same_five_ref = &five;
    let other_five_ref = &other_five;

    assert!(five_ref == same_five_ref);
    assert!(five_ref == other_five_ref);

    assert!(ptr::eq(five_ref, same_five_ref));
    assert!(!ptr::eq(five_ref, other_five_ref));Run

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)