MCPcopy Create free account
hub / github.com/brimdata/super / Eval

Method Eval

runtime/sam/expr/cast.go:124–136  ·  view source on GitHub ↗
(val super.Value)

Source from the content-addressed store, hash-verified

122}
123
124func (c *casterNet) Eval(val super.Value) super.Value {
125 if val.Type().ID() == super.IDNet {
126 return val
127 }
128 if !val.IsString() {
129 return c.sctx.WrapError("cannot cast to net", val)
130 }
131 net, err := netip.ParsePrefix(string(val.Bytes()))
132 if err != nil {
133 return c.sctx.WrapError("cannot cast to net", val)
134 }
135 return super.NewNet(net)
136}
137
138type casterDuration struct {
139 sctx *super.Context

Callers

nothing calls this directly

Calls 6

NewNetFunction · 0.92
IsStringMethod · 0.80
WrapErrorMethod · 0.80
IDMethod · 0.65
TypeMethod · 0.65
BytesMethod · 0.45

Tested by

no test coverage detected