@@ -398,6 +398,17 @@ impl AscIndexId for Array<AscPtr<AscBigDecimal>> {
398398 const INDEX_ASC_TYPE_ID : IndexForAscTypeId = IndexForAscTypeId :: ArrayBigDecimal ;
399399}
400400
401+ impl AscIndexId for Array < AscPtr < AscEnum < YamlValueKind > > > {
402+ const INDEX_ASC_TYPE_ID : IndexForAscTypeId = IndexForAscTypeId :: YamlArrayValue ;
403+ }
404+
405+ impl AscIndexId
406+ for Array < AscPtr < AscTypedMapEntry < AscEnum < YamlValueKind > , AscEnum < YamlValueKind > > > >
407+ {
408+ const INDEX_ASC_TYPE_ID : IndexForAscTypeId =
409+ IndexForAscTypeId :: YamlArrayTypedMapEntryValueValue ;
410+ }
411+
401412/// Represents any `AscValue` since they all fit in 64 bits.
402413#[ repr( C ) ]
403414#[ derive( Copy , Clone , Default ) ]
@@ -505,6 +516,10 @@ impl AscIndexId for AscEnum<JsonValueKind> {
505516 const INDEX_ASC_TYPE_ID : IndexForAscTypeId = IndexForAscTypeId :: JsonValue ;
506517}
507518
519+ impl AscIndexId for AscEnum < YamlValueKind > {
520+ const INDEX_ASC_TYPE_ID : IndexForAscTypeId = IndexForAscTypeId :: YamlValue ;
521+ }
522+
508523pub type AscEnumArray < D > = AscPtr < Array < AscPtr < AscEnum < D > > > > ;
509524
510525#[ repr( u32 ) ]
@@ -613,6 +628,10 @@ impl AscIndexId for AscTypedMapEntry<AscString, AscEnum<JsonValueKind>> {
613628 const INDEX_ASC_TYPE_ID : IndexForAscTypeId = IndexForAscTypeId :: TypedMapEntryStringJsonValue ;
614629}
615630
631+ impl AscIndexId for AscTypedMapEntry < AscEnum < YamlValueKind > , AscEnum < YamlValueKind > > {
632+ const INDEX_ASC_TYPE_ID : IndexForAscTypeId = IndexForAscTypeId :: YamlTypedMapEntryValueValue ;
633+ }
634+
616635pub ( crate ) type AscTypedMapEntryArray < K , V > = Array < AscPtr < AscTypedMapEntry < K , V > > > ;
617636
618637#[ repr( C ) ]
@@ -638,6 +657,10 @@ impl AscIndexId for AscTypedMap<AscString, AscTypedMap<AscString, AscEnum<JsonVa
638657 IndexForAscTypeId :: TypedMapStringTypedMapStringJsonValue ;
639658}
640659
660+ impl AscIndexId for AscTypedMap < AscEnum < YamlValueKind > , AscEnum < YamlValueKind > > {
661+ const INDEX_ASC_TYPE_ID : IndexForAscTypeId = IndexForAscTypeId :: YamlTypedMapValueValue ;
662+ }
663+
641664pub type AscEntity = AscTypedMap < AscString , AscEnum < StoreValueKind > > ;
642665pub ( crate ) type AscJson = AscTypedMap < AscString , AscEnum < JsonValueKind > > ;
643666
@@ -725,6 +748,10 @@ impl AscIndexId for AscResult<AscPtr<AscEnum<JsonValueKind>>, bool> {
725748 const INDEX_ASC_TYPE_ID : IndexForAscTypeId = IndexForAscTypeId :: ResultJsonValueBool ;
726749}
727750
751+ impl AscIndexId for AscResult < AscPtr < AscEnum < YamlValueKind > > , bool > {
752+ const INDEX_ASC_TYPE_ID : IndexForAscTypeId = IndexForAscTypeId :: YamlResultValueBool ;
753+ }
754+
728755#[ repr( C ) ]
729756#[ derive( AscType , Copy , Clone ) ]
730757pub struct AscWrapped < V : AscValue > {
@@ -742,3 +769,54 @@ impl AscIndexId for AscWrapped<bool> {
742769impl AscIndexId for AscWrapped < AscPtr < AscEnum < JsonValueKind > > > {
743770 const INDEX_ASC_TYPE_ID : IndexForAscTypeId = IndexForAscTypeId :: WrappedJsonValue ;
744771}
772+
773+ impl AscIndexId for AscWrapped < AscPtr < AscEnum < YamlValueKind > > > {
774+ const INDEX_ASC_TYPE_ID : IndexForAscTypeId = IndexForAscTypeId :: YamlWrappedValue ;
775+ }
776+
777+ #[ repr( u32 ) ]
778+ #[ derive( AscType , Clone , Copy ) ]
779+ pub enum YamlValueKind {
780+ Null ,
781+ Bool ,
782+ Number ,
783+ String ,
784+ Array ,
785+ Object ,
786+ Tagged ,
787+ }
788+
789+ impl Default for YamlValueKind {
790+ fn default ( ) -> Self {
791+ YamlValueKind :: Null
792+ }
793+ }
794+
795+ impl AscValue for YamlValueKind { }
796+
797+ impl YamlValueKind {
798+ pub ( crate ) fn get_kind ( value : & serde_yaml:: Value ) -> Self {
799+ use serde_yaml:: Value ;
800+
801+ match value {
802+ Value :: Null => Self :: Null ,
803+ Value :: Bool ( _) => Self :: Bool ,
804+ Value :: Number ( _) => Self :: Number ,
805+ Value :: String ( _) => Self :: String ,
806+ Value :: Sequence ( _) => Self :: Array ,
807+ Value :: Mapping ( _) => Self :: Object ,
808+ Value :: Tagged ( _) => Self :: Tagged ,
809+ }
810+ }
811+ }
812+
813+ #[ repr( C ) ]
814+ #[ derive( AscType ) ]
815+ pub struct AscYamlTaggedValue {
816+ pub tag : AscPtr < AscString > ,
817+ pub value : AscPtr < AscEnum < YamlValueKind > > ,
818+ }
819+
820+ impl AscIndexId for AscYamlTaggedValue {
821+ const INDEX_ASC_TYPE_ID : IndexForAscTypeId = IndexForAscTypeId :: YamlTaggedValue ;
822+ }
0 commit comments