OxL Reference

kw impl

Reserved keyword

The list of words: §1.4

Syntax

ebnf
Impl        = "impl" [ Type "for" ] Type "{" { ImplMember } "}" ;

Grammar: App. A

Defined in

Examples

oxl
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" }

— 4.5 impl and methods

oxl
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 }

— 12.7 Dependencies

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

See also