-
Notifications
You must be signed in to change notification settings - Fork 14
Open
Description
I have a use case where I want to manually create a slice into a source string by setting the final string content and the original offset. When I want to refer to the content I would just ignore the original_offset.
Here is the implementation I have come up with:
pub struct DetachedImString<S: Data<String>> {
content: S,
original_offset: Range<usize>,
}
impl DetachedImString {
pub fn as_str(&self) -> &str {
return &self.content
}
}
pub enum MaybeDetachedImString {
Attached(ImString),
Detached(DetachedImString)
}I wonder if this use case is something useful for others so that I submit a PR, and if you have any notes on the approach.
Metadata
Metadata
Assignees
Labels
No labels