Skip to content

Trim BorrowedCursor API #143829

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

a1phyr
Copy link
Contributor

@a1phyr a1phyr commented Jul 12, 2025

This PR removes some method from the unstable BorrowedCursor type. A rational for each change can be found in the message of each commit.

I don't think that an ACP is required for this, please tell me if it is not the case.

Cc #78485 #117693

a1phyr added 3 commits July 9, 2025 18:11
This method was not really useful: at no point one would only need to
read the initialized part of the cursor without mutating it.
I assume that this method was there for completeness, but there is
hardly any useful use of it: the buffer it gave was not always connected
to the start of the cursor and its use required `unsafe` anyway to mark
the bytes as initialized.
This enable removing the `start` field, so `BorrowedCursor` fits in a
single register. Because `written` is almost always used in difference
with another call, this changes nothing else in practice.
@rustbot
Copy link
Collaborator

rustbot commented Jul 12, 2025

r? @scottmcm

rustbot has assigned @scottmcm.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jul 12, 2025
@joshtriplett joshtriplett added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. I-libs-api-nominated Nominated for discussion during a libs-api team meeting. labels Jul 13, 2025
@joshtriplett
Copy link
Member

joshtriplett commented Jul 13, 2025

I'm surprised by the removal of init_ref(); I'd expect that to be a common need.

@a1phyr
Copy link
Contributor Author

a1phyr commented Jul 13, 2025

Why for? It gives read-only bytes that you're not supposed to read, just like the buffer of Read::read method. You were maybe thinking of filled bytes, which the API purposefully does not give access to (and the reason of #142885)?

@scottmcm
Copy link
Member

I don't think me as a reviewer is the right people to make choices here. Feels like more an unresolved question on a tracking issue -- after all, one can always stabilize a subset and decide whether to remove methods later.

r? libs-api

@rustbot rustbot assigned m-ou-se and unassigned scottmcm Jul 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-libs-api-nominated Nominated for discussion during a libs-api team meeting. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants