data_size
units.data_size
Fields
Functions
Create a string representation of this units.data_size. The string representation
is not accurate, it is either an integer in the range [100,1023],
a float in the range [10,100) with exactly one fractional digit
or a float in the range [1,10) with exactly two fractional digit
both are followed by a byte_iec (base 2) string.
is not accurate, it is either an integer in the range [100,1023],
a float in the range [10,100) with exactly one fractional digit
or a float in the range [1,10) with exactly two fractional digit
both are followed by a byte_iec (base 2) string.
Create a string representation of this units.data_size using the given unit
Output fo as_string padded for nice alignment in a table, e.g.
' 1 B '
'12.3 KiB'
' 500 MiB'
' 1 B '
'12.3 KiB'
' 500 MiB'
Create a string representation of this units.data_size using the given unit
The result is padded for alignment in a table, e.g.
' 1 B '
'1023 GiB'
'1.42 kB '
The result is padded for alignment in a table, e.g.
' 1 B '
'1023 GiB'
'1.42 kB '
Create a string representation of this units.data_size. The string representation
is not accurate, it is either an integer in the range [10,999],
a float in the range [10,100) with exactly one fractional digit
or a float in the range [1,10) with exactly two fractional digit
both are followed by a byte_si (base 10) string.
is not accurate, it is either an integer in the range [10,999],
a float in the range [10,100) with exactly one fractional digit
or a float in the range [1,10) with exactly two fractional digit
both are followed by a byte_si (base 10) string.
Output fo as_string_si padded for nice alignment in a table, e.g.
' 1 B '
'12.3 kB'
' 500 MB'
' 1 B '
'12.3 kB'
' 500 MB'
dynamic_apply -- apply `f.call` to `Any.this`'s dynamic type and value
This can be used to perform operation on values depending on their dynamic
type.
Here is an example that takes a `Sequence Any` that may contain boxed values
of types `i32` and `f64`. We can now write a feature `get_f64` that extracts
these values converted to `f64` and build a function `sum` that sums them up
as follows:
This can be used to perform operation on values depending on their dynamic
type.
Here is an example that takes a `Sequence Any` that may contain boxed values
of types `i32` and `f64`. We can now write a feature `get_f64` that extracts
these values converted to `f64` and build a function `sum` that sums them up
as follows:
Get the dynamic type of this instance. For value instances `x`, this is
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
equal to `type_of x`, but for `x` with a `ref` type `x.dynamic_type` gives
the actual runtime type, while `type_of x` results in the static
compile-time type.
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types. So for Type values, dynamic_type is redefined
to just return Type.type.
this units.data_size multiplied by factor n
this units.data_size and another one combined
this units.data_size minus another units.data_size
this units.data_size divided by units.data_size other, rounding down
convenience prefix operator to create a string from a value.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
this units.data_size in quebibytes (1024**10 bytes), including fractional part
Scales this data size by a floating-point factor.
This operation is approximate:
- The factor is a floating-point value and may be imprecise.
- Fractional bytes are not representable and will be rounded.
- Large values may not be exactly representable in a float and are
therefore approximated before conversion back to bytes.
Use the `infix *` for exact, byte-precise scaling with integers.
This operation is approximate:
- The factor is a floating-point value and may be imprecise.
- Fractional bytes are not representable and will be rounded.
- Large values may not be exactly representable in a float and are
therefore approximated before conversion back to bytes.
Use the `infix *` for exact, byte-precise scaling with integers.
Determines the iec unit to use for as_string,
such that the resulting value is in the range [1,1024)
such that the resulting value is in the range [1,1024)
Determines the si prefixed unit to use for as_string,
such that the resulting value is is in the range [1,1000)
such that the resulting value is is in the range [1,1000)
Type Functions
string representation of this type to be used for debugging.
result has the form "Type of '<name>'", but this might change in the future
result has the form "Type of '<name>'", but this might change in the future
create units.data_size of n bytes
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
There is no dynamic type of a type instance since this would result in an
endless hierarchy of types, so dynamic_type is redefined to just return
Type.type here.
endless hierarchy of types, so dynamic_type is redefined to just return
Type.type here.
create units.data_size of n exabytes (10**18 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
create units.data_size of n exbibytes (1024**6 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
equality implements the default equality relation for values of this type.
This relation must be
- reflexive (equality a a),
- symmetric (equality a b = equality b a), and
- transitive ((equality a b && equality b c) : equality a c).
result is true iff 'a' is considered to represent the same abstract value
as 'b'.
This relation must be
- reflexive (equality a a),
- symmetric (equality a b = equality b a), and
- transitive ((equality a b && equality b c) : equality a c).
result is true iff 'a' is considered to represent the same abstract value
as 'b'.
create units.data_size of n gigabytes (10**9 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
create units.data_size of n gibibytes (1024**3 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
create hash code from a units.data_size
Is this type assignable to a type parameter with constraint `T`?
The result of this is a compile-time constant that can be used to specialize
code for a particular type.
it is most useful in conjunction with preconditions or `if` statements as in
or
The result of this is a compile-time constant that can be used to specialize
code for a particular type.
it is most useful in conjunction with preconditions or `if` statements as in
or
create units.data_size of n kilobytes (10**3 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
create units.data_size of n kibibytes (1024**1 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
(a units.data_size, b units.data_size) => bool[Redefinition of property.partially_orderable.type.lteq]¶
(a units.data_size, b units.data_size)
=>
bool[Redefinition of property.partially_orderable.type.lteq]
¶total order
the maximum units.data_size
max value for a units.data_size given in bytes
max value for a units.data_size given in exabytes (10**18 bytes)
max value for a units.data_size given in exbibytes (1024**6 bytes)
max value for a units.data_size given in gibibytes (1024**3 bytes)
max value for a units.data_size given in gigabytes (10**9 bytes)
max value for a units.data_size given in kibibytes (1024**1 bytes)
max value for a units.data_size given in kilobytes (10**3 bytes)
max value for a units.data_size given in mebibytes (1024**2 bytes)
max value for a units.data_size given in megabytes (10**6 bytes)
max value for a units.data_size given in pebibytes (1024**5 bytes)
max value for a units.data_size given in petabytes (10**15 bytes)
max value for a units.data_size given in quebibytes (1024**10 bytes)
max value for a units.data_size given in quettabytes (10**30 bytes)
max value for a units.data_size given in robibytes (1024**9 bytes)
max value for a units.data_size given in ronnabytes (10**27 bytes)
max value for a units.data_size given in tebibytes (1024**4 bytes)
max value for a units.data_size given in terabytes (10**12 bytes)
max value for a units.data_size given in yobibytes (1024**8 bytes)
max value for a units.data_size given in yottabytes (10**24 bytes)
max value for a units.data_size given in zebibytes (1024**7 bytes)
max value for a units.data_size given in zettabytes (10**21 bytes)
create units.data_size of n megabytes (10**6 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
create units.data_size of n mebibytes (1024**2 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
name of this type, including type parameters, e.g. 'option (list i32)'.
create units.data_size of n petabytes (10**15 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
create units.data_size of n pebibytes (1024**5 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
convenience prefix operator to create a string from a value.
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
NYI: Redefinition allows the type feature to be distinguished from its normal counterpart, see #3913
This permits usage of `$` as a prefix operator in a similar way both
inside and outside of constant strings: $x and "$x" will produce the
same string.
NYI: Redefinition allows the type feature to be distinguished from its normal counterpart, see #3913
create units.data_size of n quettabytes (10**30 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
create units.data_size of n quebibytes (1024**10 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
create units.data_size of n ronnabytes (10**27 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
create units.data_size of n robibytes (1024**9 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
create units.data_size of n terabytes (10**12 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
create units.data_size of n tebibytes (1024**4 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
Get a type as a value.
This is a feature with the effect equivalent to Fuzion's `expr.type` call tail.
It is recommended to use `expr.type` and not `expr.type_value`.
`type_value` is here to show how this can be implemented and to illustrate the
difference to `dynamic_type`.
This is a feature with the effect equivalent to Fuzion's `expr.type` call tail.
It is recommended to use `expr.type` and not `expr.type_value`.
`type_value` is here to show how this can be implemented and to illustrate the
difference to `dynamic_type`.
create units.data_size of n yottabytes (10**24 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
create units.data_size of n yobibytes (1024**8 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
create units.data_size of n zettabytes (10**21 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
the zero units.data_size, representing a zero bytes
create units.data_size of n zebibytes (1024**7 bytes)
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
NYI: Turn this into a 'postfix' call, see https://fuzion-lang.dev/design/postfix_calls
Applicable universe features
These are features in universe, that have an argument with a type constraint that matches this features type and can therefore be used with it.
equals -- feature that compares two values using the equality relation
defined in their type
defined in their type
hash of a value
infix = -- infix operation as shorthand for 'equals'
does this come strictly before other?
infix <= -- infix operation as shorthand for 'lteq'
three-way comparison between this and other.
result is < 0 if this < other
result is > 0 if this > other
result is = 0 if this = other
result is < 0 if this < other
result is > 0 if this > other
result is = 0 if this = other
infix = -- infix operation as shorthand for 'equals'
does this come strictly after other?
does this come after other?
is `a` contained in `Set` `s`?
This should usually be called using type inference as in
This should usually be called using type inference as in
is `a` not contained in `Set` `s`?
This should usually be called using type inference as in
This should usually be called using type inference as in
infix ≟ -- infix operation as shorthand for 'equals'
infix ≤ -- infix operation as shorthand for 'lteq'
does this come after other?
three-way comparison between this and other.
result is < 0 if this < other
result is > 0 if this > other
result is = 0 if this = other
result is < 0 if this < other
result is > 0 if this > other
result is = 0 if this = other
does this come strictly before other?
does this come strictly after other?
lteq -- feature that compares two values using the lteq relation
defined in their type
defined in their type
maximum of two values
memoize `f`.
wraps f so that f will only be called once for every unique input.
The term "memoization" was coined by Donald Michie in 1968 and
is derived from the Latin word "memorandum" ("to be remembered"),
usually truncated as "memo" in American English, and thus carries
the meaning of "turning a function into something to be remembered".
https://en.wikipedia.org/wiki/Memoization
example:
wraps f so that f will only be called once for every unique input.
The term "memoization" was coined by Donald Michie in 1968 and
is derived from the Latin word "memorandum" ("to be remembered"),
usually truncated as "memo" in American English, and thus carries
the meaning of "turning a function into something to be remembered".
https://en.wikipedia.org/wiki/Memoization
example:
minimum of two values
0.095dev (GIT hash 09dff08de289bbb6f7136c7e2f8c66dcc1856bba)
Note - The maximum representable value is 340,282,366 QB or 268,435,455 QiB,
due to using u128 internally.