@@ -56,7 +56,7 @@ enum TyUserError {
5656
5757/// Types of `[]` operator.
5858#[ derive( Allocative , Debug ) ]
59- pub ( crate ) struct TyUserIndex {
59+ pub struct TyUserIndex {
6060 /// Type of index argument.
6161 pub ( crate ) index : Ty ,
6262 /// Type of result.
@@ -65,27 +65,36 @@ pub(crate) struct TyUserIndex {
6565
6666/// Fields of the struct.
6767#[ derive( Allocative , Debug , Ord , PartialOrd , Eq , PartialEq , Hash ) ]
68- pub ( crate ) struct TyUserFields {
68+ pub struct TyUserFields {
6969 /// Known fields.
70- pub ( crate ) known : SortedMap < String , Ty > ,
70+ pub known : SortedMap < String , Ty > ,
7171 /// Are there unknown fields?
7272 /// Unknown fields are possible if this type represents an abstract type like a provider.
73- pub ( crate ) unknown : bool ,
73+ pub unknown : bool ,
7474}
7575
7676impl TyUserFields {
77- pub ( crate ) fn no_fields ( ) -> TyUserFields {
77+ /// No fields.
78+ pub fn no_fields ( ) -> TyUserFields {
7879 TyUserFields {
7980 known : SortedMap :: new ( ) ,
8081 unknown : false ,
8182 }
8283 }
84+
85+ /// All fields are not known.
86+ pub fn unknown ( ) -> TyUserFields {
87+ TyUserFields {
88+ known : SortedMap :: new ( ) ,
89+ unknown : true ,
90+ }
91+ }
8392}
8493
8594/// Type description for arbitrary type.
8695#[ derive( Allocative , Debug , derive_more:: Display ) ]
8796#[ display( fmt = "{}" , name) ]
88- pub ( crate ) struct TyUser {
97+ pub struct TyUser {
8998 name : String ,
9099 /// Base type for this custom type, e.g. generic record for record with known fields.
91100 base : TyStarlarkValue ,
@@ -101,7 +110,8 @@ pub(crate) struct TyUser {
101110}
102111
103112impl TyUser {
104- pub ( crate ) fn new (
113+ /// Constructor.
114+ pub fn new (
105115 name : String ,
106116 base : TyStarlarkValue ,
107117 matcher : Option < TypeMatcherFactory > ,
0 commit comments