* Returns a new Encoding instance with the given service injected into the encoding effect context. * * **When to use** * * Use when the schema's encoder requires a service dependency. * * @see Decoding.provide
(
service: Context.Key<Id, Service>,
implementation: Service
)
| 557 | * @see {@link Decoding.provide} |
| 558 | */ |
| 559 | provide<Id, Service>( |
| 560 | service: Context.Key<Id, Service>, |
| 561 | implementation: Service |
| 562 | ): Encoding<Schema.middlewareEncoding<S, Exclude<S["EncodingServices"], Id>>> { |
| 563 | return new Encoding( |
| 564 | pipe(this.schema, Schema.middlewareEncoding(Effect.provideService(service, implementation))), |
| 565 | this.options |
| 566 | ) |
| 567 | } |
| 568 | } |