Skip to content
This repository has been archived by the owner on Jan 11, 2025. It is now read-only.

Update mcs devel #15

Merged
merged 10 commits into from
Aug 26, 2024
Merged

Update mcs devel #15

merged 10 commits into from
Aug 26, 2024

Conversation

Kiwifuit
Copy link
Owner

@Kiwifuit Kiwifuit commented Aug 26, 2024

Summary by Sourcery

Refactor the codebase to use Rc<str> for string fields in various data structures, enhancing memory efficiency. Update deserialization logic to support these changes and clean up the project by removing obsolete files.

Enhancements:

  • Refactor multiple structs across various modules to use Rc<str> for string fields, improving memory efficiency by enabling shared ownership of strings.
  • Update deserialization logic to accommodate the use of Rc<str> in place of String, ensuring compatibility with the new data structures.
  • Modify the ModpackProviderMetadata trait to use an associated type for return values, allowing for more flexible implementations.

Chores:

  • Remove unused files from the mcs directory, including configuration files and source code, to clean up the project structure.

Copy link

sourcery-ai bot commented Aug 26, 2024

Reviewer's Guide by Sourcery

This pull request updates the 'mcs devel' branch with significant changes to improve memory efficiency and performance across multiple Rust crates. The main focus is on replacing String types with Rc for better memory management and introducing Arc<[T]> for thread-safe reference-counted slices.

File-Level Changes

Change Details Files
Replace String with Rc for improved memory efficiency
  • Change String fields to Rc in struct definitions
  • Update function signatures to use Rc instead of String
  • Modify clone() calls to use Rc::clone()
  • Adjust string comparisons to work with Rc
modparser/src/types/forge.rs
modrinth/src/types/project.rs
modparser/src/types/fabric.rs
hangar/src/types/query/search.rs
modrinth/src/types/version.rs
hangar/src/types/project.rs
hangar/src/types/version.rs
hangar/src/types/version/details.rs
Introduce Arc<[T]> for thread-safe reference-counted slices
  • Replace Vec with Arc<[T]> in struct definitions
  • Update function signatures to return Arc<[T]> instead of Vec
  • Modify vector operations to work with Arc<[T]>
modrinth/src/types/result.rs
mar/src/types/deserialize.rs
Update trait definitions and implementations for better type safety
  • Modify ModrinthProjectMeta trait to use associated types
  • Update implementations of ModrinthProjectMeta trait
  • Adjust ModpackProviderMetadata trait to use associated types
modrinth/src/types/mod.rs
mparse/src/types/mod.rs
Refactor error handling and API functions
  • Update APIError enum to use Rc instead of String
  • Modify API functions to handle new types and trait bounds
  • Adjust error messages and logging to work with new types
modrinth/src/api/mod.rs
modrinth/src/api/version.rs
modrinth/src/api/project.rs
Remove unused files and update project structure
  • Delete unnecessary configuration and source files
  • Update GitHub Actions workflow file
mcs/end2end/tsconfig.json
mcs/end2end/playwright.config.ts
mcs/README.md
mcs/src/main.rs
mcs/src/app.rs
mcs/src/lib.rs
mcs/style/main.scss
.github/workflows/test.yml

Tips
  • Trigger a new Sourcery review by commenting @sourcery-ai review on the pull request.
  • Continue your discussion with Sourcery by replying directly to review comments.
  • You can change your review settings at any time by accessing your dashboard:
    • Enable or disable the Sourcery-generated pull request summary or reviewer's guide;
    • Change the review language;
  • You can always contact us if you have any questions or feedback.

@Kiwifuit Kiwifuit merged commit c5193ed into mcs/devel Aug 26, 2024
1 check passed
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @Kiwifuit - I've reviewed your changes - here's some feedback:

Overall Comments:

  • The widespread use of Rc<str> instead of String could potentially improve memory efficiency, but may also introduce performance overhead due to reference counting. Please provide profiling data or benchmarks demonstrating the benefits of this change.
  • Consider the impact on the public API and ease of use for library consumers. The introduction of Rc types may make the API more complex and harder to work with.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@@ -16,8 +17,10 @@ pub use query::{Facet, FacetOp};

#[cfg(feature = "types")]
pub(crate) trait ModrinthProjectMeta {
fn project_id(&self) -> Option<&String>;
fn version_id(&self) -> Option<&String> {
type Id;
Copy link

Choose a reason for hiding this comment

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

suggestion: Document the purpose of the Id associated type

Adding a brief comment explaining the rationale behind this change would improve code clarity.

Suggested change
type Id;
/// Represents the type used for project and version identifiers.
/// This allows for flexibility in how IDs are represented across different implementations.
type Id;

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

Successfully merging this pull request may close these issues.

1 participant