Skip to content

Conversation

@AhoyISki
Copy link

Hello

In std, Vec::new() is a const function. To me, it seems unexpected that Gapbuffer::new() is not a const function. This also prevents some useful statements like

static MUTEX = Mutex<GapBuffer<u8>> = Mutex::new(GapBuffer::new());

Instead, because of the non constness of GapBuffer::new(), you are forced to write:

static MUTEX: LazyLock<Mutex<GapBuffer<u8>>> = LazyLock::new(Mutex::default);

Which not only is more of a mouthful, in theory it is also slower, because of the LazyLock part.

@AhoyISki
Copy link
Author

Also, it'd be nice if this coincided with a new version on crates.io.

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.

1 participant