_metadata

trait _metadata[A]

Stream Metadata Interface

Metadata is a static knowledge about stream elements to be delivered

Metadata methods can be called many times, they do not trigger any data movements

Source
_metadata.scala
class java.lang.Object
trait scala.Matchable
class Any
trait _use
object Stream

Def

inline def docTree: Doc.Tree

Doc Tree description

Doc Tree description

Returns a tree describing all stream trasformations

('a' <> 'z').stream
 .map(_.toInt)
 .take(_ % 2 == 0)
 .docTree.tp

// Output
scalqa.lang.int.g.Stream$TakeStream$2@4ds1{raw=Int}
 scalqa.lang.char.z.stream.map$Ints@j38c{raw=Int,fromRaw=Char,size=26}
   scalqa.lang.char.Z$Stream_fromRange@gw1k{raw=Char,size=26,from=a,step=1}
Source
_metadata.scala
inline def sizeLongOpt: Long.Opt

Optional long size

Optional long size

Many streams can return their current element count. If the information is not available, void option is returned

var s = (Int.min.Long <> Int.max.toLong).stream

s.sizeLongOpt.tp    // Prints Long.Opt(4294967296)

s = s.take(_ > 10)  // static sizing is lost

s.sizeLongOpt.tp    // Prints Long.Opt(VOID)
Source
_metadata.scala
inline def sizeOpt: Int.Opt

Optional size

Optional size

Many streams can return their current element count. If the information is not available, void option is returned

Note: If size is known, but exceeds integer range, void option is returned. For theses cases use sizeLongOpt

 var s = ('a' <> 'z').stream

 s.sizeOpt.tp         // Prints Int.Opt(26)

 s = s.take(_ > 10)   // static sizing is lost

 s.sizeOpt.tp         // Prints Int.Opt(VOID)
Source
_metadata.scala