4 [<img alt="github" src="https://img.shields.io/badge/github-dtolnay/inherent-8da0cb?style=for-the-badge&labelColor=555555&logo=github" height="20">](https://github.com/dtolnay/inherent)
5 [<img alt="crates.io" src="https://img.shields.io/crates/v/inherent.svg?style=for-the-badge&color=fc8d62&logo=rust" height="20">](https://crates.io/crates/inherent)
6 [<img alt="docs.rs" src="https://img.shields.io/badge/docs.rs-inherent-66c2a5?style=for-the-badge&labelColor=555555&logo=docs.rs" height="20">](https://docs.rs/inherent)
7 [<img alt="build status" src="https://img.shields.io/github/actions/workflow/status/dtolnay/inherent/ci.yml?branch=master&style=for-the-badge" height="20">](https://github.com/dtolnay/inherent/actions?query=branch%3Amaster)
9 This crate provides an attribute macro to make trait methods callable without
21 use inherent::inherent;
30 impl Trait for Struct {
36 // types::Trait is not in scope, but method can be called.
41 Without the `inherent` macro on the trait impl, this would have failed with the
45 error[E0599]: no method named `f` found for type `types::Struct` in the current scope
48 8 | pub struct Struct;
49 | ------------------ method `f` not found for this
51 18 | types::Struct.f();
54 = help: items from traits can only be used if the trait is implemented and in scope
55 = note: the following trait defines an item `f`, perhaps you need to implement it:
56 candidate #1: `types::Trait`
59 The `inherent` macro expands to inherent methods on the `Self` type of the trait
60 impl that forward to the trait methods. In the case above, the generated code
66 <Self as Trait>::f(self)
76 Licensed under either of <a href="LICENSE-APACHE">Apache License, Version
77 2.0</a> or <a href="LICENSE-MIT">MIT license</a> at your option.
83 Unless you explicitly state otherwise, any contribution intentionally submitted
84 for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
85 be dual licensed as above, without any additional terms or conditions.