Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Mar 22, 2024. It is now read-only.

Improve use StringCursor instead index based char fetch #17

Merged
merged 4 commits into from
Jan 17, 2024

Conversation

qingshi163
Copy link
Contributor

@qingshi163 qingshi163 commented Jan 13, 2024

#17

Comment on lines +2 to +5
pub struct StringCursor {
pub(crate) ptr: *const u8,
pub position: usize,
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this &[u8] or different to it?

e.g. will this version work?

pub struct StringCursor {
    bytes: &[u8],
}

cursor.bytes = ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nop, position is character position, ptr is bytes cursor.

@qingshi163 qingshi163 merged commit 21fc205 into RustPython:main Jan 17, 2024
@qingshi163 qingshi163 deleted the string-cursor branch January 17, 2024 14:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants