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

Impl From<Encoding> for Scene. #538

Merged

Conversation

waywardmonkeys
Copy link
Contributor

This allows creating a Scene with a pre-existing Encoding.

Fixes #530.

src/scene.rs Outdated Show resolved Hide resolved
src/scene.rs Outdated
@@ -219,6 +223,17 @@ impl Scene {
}
}

impl From<Encoding> for Scene {
fn from(encoding: Encoding) -> Self {
// TODO: Properly update the estimator for the encoding.
Copy link
Member

Choose a reason for hiding this comment

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

And this is why I'd make it a from_encoding method, to document that the bump estimator will undercount items added in this method

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In other conversations, it has already been said that the implementation strategy of the estimator will be changing and this issue would go away.

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that if you're adding a TODO to the code, it's usually good practice to join a link to a ticket (usually a github issue) tracking down whatever needs to be done to remove that TODO.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It matches the existing TODO comments elsewhere in the file for the same feature. (Also, out of roughly 80 TODOs in this repo, approximately 2 have an issue number in them.)

Copy link
Contributor

Choose a reason for hiding this comment

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

We can do a comments pass at some point, but I think at least new comments should follow that practice.

Copy link
Member

Choose a reason for hiding this comment

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

We could point to #530 (comment)

Copy link
Member

Choose a reason for hiding this comment

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

Or indeed #541

@waywardmonkeys
Copy link
Contributor Author

If there's feedback that this functionality is desired, I'll think about updating and re-opening or someone else can run this gauntlet.

This allows creating a `Scene` with a pre-existing `Encoding`.

Fixes linebender#530.
@waywardmonkeys waywardmonkeys reopened this Apr 2, 2024
@waywardmonkeys waywardmonkeys force-pushed the allow-creation-of-scene-from-encoding branch from 73abc10 to 24fdd3f Compare April 2, 2024 14:47
Copy link
Member

@DJMcNab DJMcNab left a comment

Choose a reason for hiding this comment

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

Thanks - this looks like it should give more flexibility to consumers

The concern about bump estimation and the future state of that are valid, but we're in flux at the moment, and @armansito's comment in the linked issue is clear enough that the bump estimator field will change substantially

I don't think adding a link to that comment is too important, although it would probably be an improvement

src/scene.rs Outdated
@@ -219,6 +223,17 @@ impl Scene {
}
}

impl From<Encoding> for Scene {
fn from(encoding: Encoding) -> Self {
// TODO: Properly update the estimator for the encoding.
Copy link
Member

Choose a reason for hiding this comment

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

We could point to #530 (comment)

@DJMcNab DJMcNab enabled auto-merge April 23, 2024 08:46
@DJMcNab
Copy link
Member

DJMcNab commented Apr 23, 2024

Thanks! This is a good extension to our API

@DJMcNab DJMcNab added this pull request to the merge queue Apr 23, 2024
Merged via the queue into linebender:main with commit 45c872a Apr 23, 2024
15 checks passed
@waywardmonkeys waywardmonkeys deleted the allow-creation-of-scene-from-encoding branch April 25, 2024 10:49
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.

Appending an Encoding to a Scene
3 participants