Mojo function
repr
repr[T: Representable](value: T) -> String
Returns the string representation of the given value.
Parameters:
- T (
Representable
): The type ofvalue
. Must implement theRepresentable
trait.
Args:
- value (
T
): The value to get the string representation of.
Returns:
String
: The string representation of the given value.
repr[T: Representable & Movable & Copyable](value: List[T]) -> String
Returns the string representation of a List[T]
.
Parameters:
- T (
Representable
&Movable
&Copyable
): A type that implementsRepresentableCollectionElement
.
Args:
- value (
List
): AList
of elementsT
.
Returns:
String
: The string representation of List[T]
.
repr[K: ExplicitlyCopyable & Movable & Hashable & EqualityComparable & Representable, V: ExplicitlyCopyable & Movable & Representable](value: Dict[K, V]) -> String
Returns the string representation of a Dict[K,V]
.
Parameters:
- K (
ExplicitlyCopyable
&Movable
&Hashable
&EqualityComparable
&Representable
): A type that implementsKeyElement
andRepresentable
. - V (
ExplicitlyCopyable
&Movable
&Representable
): A type that implementsMovable
,Copyable
andRepresentable
.
Args:
- value (
Dict
): ADict
of keysK
and elementsV
.
Returns:
String
: The string representation of Dict[K,V]
.
repr[U: ExplicitlyCopyable & Movable & Hashable & EqualityComparable & Representable](value: Set[U]) -> String
Returns the string representation of an Set[U]
.
Parameters:
- U (
ExplicitlyCopyable
&Movable
&Hashable
&EqualityComparable
&Representable
): A type that implementsKeyElement
andRepresentable
.
Args:
- value (
Set
): ASet
of elementsU
.
Returns:
String
: The string representation of Set[U]
.
repr[U: Representable & Copyable & Movable](value: Optional[U]) -> String
Returns the string representation of an Optional[U]
.
Parameters:
- U (
Representable
&Copyable
&Movable
): A type that implementsMovable
,Copyable
andRepresentable
.
Args:
- value (
Optional
): AOptional
of element typeU
.
Returns:
String
: The string representation of Optional[U]
.
repr[U: ExplicitlyCopyable & Movable & Writable](value: LinkedList[U]) -> String
Returns the string representation of an LinkedList[U]
.
Parameters:
- U (
ExplicitlyCopyable
&Movable
&Writable
): A type that implementsMovable
,ExplicitlyCopyable
andWritable
.
Args:
- value (
LinkedList
): ALinkedList
of element typeU
.
Returns:
String
: The string representation of LinkedList[U]
.
repr[T: Representable & ExplicitlyCopyable & Movable](value: Deque[T]) -> String
Returns the string representation of an Deque[U]
.
Parameters:
- T (
Representable
&ExplicitlyCopyable
&Movable
): A type that implementsMovable
,ExplicitlyCopyable
andRepresentable
.
Args:
- value (
Deque
): ADeque
of element typeU
.
Returns:
String
: The string representation of Deque[U]
.
repr(value: None) -> String
Returns the string representation of None
.
Args:
- value (
None
): ANone
value.
Returns:
String
: The string representation of None
.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!