Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTransformingDecoder ¶
NewTransformingDecoder constructs a dials.Decoder wrapping a slice of `transform.Mangler`s and another decoder.
func NewTransformingSource ¶
NewTransformingSource constructs a dials.Source wrapping a slice of `transform.Mangler`s and another source. It picks the underlying implementation based on whether the wrapped source implements the Watcher interface to preserve that property.
Types ¶
type Blank ¶
type Blank struct {
// contains filtered or unexported fields
}
Blank operates as a blank Source in its default state. It provides a SetSource method for updating the inner Source later and uses the dials.Watcher interface to update the View it's inserted into.
Blanks cannot be reused as they have to be aware of parameters of a particular View.
Note that when using this, consider setting `SkipInitialVerification` on `dials.Params` to `true` if any data from Blank-wrapped sources is considered critical by the `Verify()` method provided by a configuration implementing `dials.VerifiedConfig`.
For instance, consider when one's configuration implements `dials.VerifiedConfig` and should receive data from two Sources, one being wrapped by `sourcewrap.Blank`. When `SkipInitialVerification` is `false`, `params.Config` will call `Verify()` before the Blank-wrapped source has a chance to have its inner Source updated. Therefore, this initial call to `Verify()` will only have data provided by the non-Blank-wrapped source.
func (*Blank) Done ¶
Done instructs Dials that this Blank source will never be used in a watching mode ever again (allowing Dials to shutdown a goroutine once all other sources implementing Watcher have called Done()). This call is a nop if a source implementing the Watcher interface is present within Blank. (Semantically, the WatchArgs are no longer the Blank's once a Watcher-implementing Source is set)
func (*Blank) SetSource ¶
SetSource sets the wrapped source, switching the Blank into full delegation mode. The new Source's Value() method will be called, and the return value will be pushed to the view via the asynchronous watch interface. If the new Source implements dials.Watcher, its Watch method will be called.
It is safe to call SetSource multiple times with different Sources, however, once a Watcher is set as the inner source, it takes over ownership of the state for the slot and cannot be replaced.