MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / accepts_type

Method accepts_type

src/sql/src/func.rs:755–770  ·  view source on GitHub ↗

Does `self` accept arguments of type `t`?

(&self, ecx: &ExprContext, t: &SqlScalarType)

Source from the content-addressed store, hash-verified

753impl ParamType {
754 /// Does `self` accept arguments of type `t`?
755 fn accepts_type(&self, ecx: &ExprContext, t: &SqlScalarType) -> bool {
756 use ParamType::*;
757 use SqlScalarType::*;
758
759 match self {
760 Any | AnyElement | AnyCompatible | ListElementAnyCompatible => true,
761 ArrayAny | ArrayAnyCompatible => matches!(t, Array(..) | Int2Vector),
762 ListAny | ListAnyCompatible => matches!(t, List { .. }),
763 MapAny | MapAnyCompatible => matches!(t, Map { .. }),
764 RangeAny | RangeAnyCompatible => matches!(t, Range { .. }),
765 NonVecAny | NonVecAnyCompatible => !t.is_vec(),
766 Internal => false,
767 Plain(to) => typeconv::can_cast(ecx, CastContext::Implicit, t, to),
768 RecordAny => matches!(t, Record { .. }),
769 }
770 }
771
772 /// Does `t`'s [`TypeCategory`] prefer `self`? This question can make
773 /// more sense with the understanding that pseudotypes are never preferred.

Callers 2

matches_argtypesMethod · 0.80
find_matchFunction · 0.80

Calls 2

can_castFunction · 0.85
is_vecMethod · 0.80

Tested by

no test coverage detected