Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add concat_slice and mark everything as unsafe #7

Merged
merged 8 commits into from
Feb 5, 2020

Conversation

HeroicKatora
Copy link
Collaborator

Chooses the very cautious option of erroring in all cases of a ZST
concatentation for now.

Chooses the very cautious option of erroring in all cases of a ZST
concatentation.
Copy link
Owner

@oberien oberien left a comment

Choose a reason for hiding this comment

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

What do you think about combining concat and concat_slice like this? I think it would make the usage more intuitive.

src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Outdated Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
src/lib.rs Show resolved Hide resolved
@HeroicKatora
Copy link
Collaborator Author

HeroicKatora commented Jul 17, 2019

What do you think about combining concat and concat_slice like this? I think it would make the usage more intuitive.

Adding a trait to the interface that can not be implemented seems to complicate the interface (it requires an additional indirection to find the valid uses). I'd either rename the methods to concat and concat_str or simply add the trait for str and [T] but not seal it.

trait Concat {
    fn concat(&self, other: &'_ Self) -> Result<&'_ Self, Error>;
}

See issue oberien#7, we must guarantee that slices are from the same
allocation. However, pointer equality testing can not reliably test this
so it must be provided by the caller.

Some actual safe interface is coming back at some point, currently the
proof obligation is still highly reduced.
HeroicKatora added a commit to HeroicKatora/str-concat that referenced this pull request Jul 22, 2019
See issue oberien#7, we must guarantee that slices are from the same
allocation. However, pointer equality testing can not reliably test this
so it must be provided by the caller.

Some actual safe interface is coming back at some point, currently the
proof obligation is still highly reduced.
@HeroicKatora HeroicKatora changed the title Add concat_slice Add concat_slice and mark everything as unsafe Jul 25, 2019
src/lib.rs Show resolved Hide resolved
@oberien
Copy link
Owner

oberien commented Feb 5, 2020

Could you please also add an example of concat to the Readme?
Edit: Could you please also wrap the current examples in unsafe?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants