Skip to content

Commit

Permalink
fix docstrings
Browse files Browse the repository at this point in the history
Signed-off-by: martinvuyk <[email protected]>
  • Loading branch information
martinvuyk committed Feb 1, 2025
1 parent 163a5e6 commit ae53225
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions stdlib/src/builtin/string_literal.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -440,20 +440,20 @@ struct StringLiteral(
return self.__str__()

fn __iter__(ref self) -> _StringSliceIter[StaticConstantOrigin]:
"""Return an iterator over the string literal.
"""Iterate over the string unicode characters.
Returns:
An iterator over the string.
An iterator of references to the string unicode characters.
"""
return _StringSliceIter[StaticConstantOrigin](
ptr=self.unsafe_ptr(), length=self.byte_length()
)

fn __reversed__(self) -> _StringSliceIter[StaticConstantOrigin, False]:
"""Iterate backwards over the string, returning immutable references.
"""Iterate backwards over the string unicode characters.
Returns:
A reversed iterator over the string.
A reversed iterator of references to the string unicode characters.
"""
return _StringSliceIter[StaticConstantOrigin, False](
ptr=self.unsafe_ptr(), length=self.byte_length()
Expand Down
8 changes: 4 additions & 4 deletions stdlib/src/collections/string/string.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -1064,18 +1064,18 @@ struct String(
self._iadd[False](other.as_bytes())

fn __iter__(self) -> _StringSliceIter[__origin_of(self)]:
"""Iterate over the string, returning immutable references.
"""Iterate over the string unicode characters.
Returns:
An iterator of references to the string elements.
An iterator of references to the string unicode characters.
"""
return self.char_slices()

fn __reversed__(self) -> _StringSliceIter[__origin_of(self), False]:
"""Iterate backwards over the string, returning immutable references.
"""Iterate backwards over the string unicode characters.
Returns:
A reversed iterator of references to the string elements.
A reversed iterator of references to the string unicode characters.
"""
return _StringSliceIter[__origin_of(self), forward=False](
ptr=self.unsafe_ptr(), length=self.byte_length()
Expand Down
8 changes: 4 additions & 4 deletions stdlib/src/collections/string/string_slice.mojo
Original file line number Diff line number Diff line change
Expand Up @@ -791,18 +791,18 @@ struct StringSlice[mut: Bool, //, origin: Origin[mut]](
)

fn __iter__(self) -> _StringSliceIter[origin]:
"""Iterate over the string, returning immutable references.
"""Iterate over the string unicode characters.
Returns:
An iterator of references to the string elements.
An iterator of references to the string unicode characters.
"""
return self.char_slices()

fn __reversed__(self) -> _StringSliceIter[origin, False]:
"""Iterate backwards over the string, returning immutable references.
"""Iterate backwards over the string unicode characters.
Returns:
A reversed iterator of references to the string elements.
A reversed iterator of references to the string unicode characters.
"""
return _StringSliceIter[origin, forward=False](
ptr=self.unsafe_ptr(), length=self.byte_length()
Expand Down

0 comments on commit ae53225

Please sign in to comment.