kw impl
Reserved keyword
The list of words: §1.4
Syntax
Impl = "impl" [ Type "for" ] Type "{" { ImplMember } "}" ;Grammar: App. A
Defined in
- 4.5 impl and methods — Inside a method self and Self are available.
- 4.3 Construction and constructors — Literal. T{ f1: e1, f2, ..base }
- 10.1 Services — A service declares a contract
- 12.7 Dependencies — provide Type = expression (for role r, …)?
- 4.7 Embedding and overriding — There is no implementation inheritance.
- 5.3 Overloading and user-defined operators — Overloading built-in operators — op declarations in impl
- 9.5 User-defined serialisers — Level 1 — representation through another type (Repr), acts in all formats and in schemas
- 0.1 Normative terms — There is no undefined behaviour in safe code.
Examples
impl Money {
pub const ZERO: Money = Money{ minor: 0 }
pub const MAX_TRANSFER: Money = Money.rub(1_000_000)
}
interface Codec<T> { const NAME: str } // the implementation must supply a value
impl Codec<Point> for GeoHashCodec { const NAME: str = "geohash" }provide Db = Db.open(App.get().dbUrl) for role api, saga
provide Payments = PaymentsClient.new(App.get().stripeKey)
impl Orders { dep db: Db; dep pay: Payments }Related diagnostics
impl-foreign-type, unknown-method, bad-init, missing-field, must-close, positional-literal, sealed-literal, duplicate-impl, impl-signature-mismatch, missing-impl, missing-rpc-impl, unknown-rpc, duplicate-provide, missing-provide