Skip to content

feat(di): Allow changing the visibility of the generated dependency container#42

Merged
chesedo merged 1 commit intomainfrom
dependency_container_visibility
Nov 17, 2025
Merged

feat(di): Allow changing the visibility of the generated dependency container#42
chesedo merged 1 commit intomainfrom
dependency_container_visibility

Conversation

@chesedo
Copy link
Owner

@chesedo chesedo commented Nov 15, 2025

This is done by adding a visibility modifier on the macro invocation:

// `MyContainer` will be a `pub` struct
#[dependency_container(pub)]
impl MyContainer { }

Closes #40

This is done by adding a visibility modifier on the macro invocation:

```rust
// `MyContainer` will be a `pub` struct
impl MyContainer { }
```
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for configuring the visibility of generated dependency container structs through the #[dependency_container] macro. By default, containers remain private, but users can now specify visibility modifiers like pub, pub(crate), pub(super), or pub(in path) as macro arguments.

  • Added visibility modifier parameter to the #[dependency_container] macro
  • Threaded visibility through input parsing, processing, and output generation layers
  • Added comprehensive test coverage for all Rust visibility modifiers

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
despatma/src/lib.rs Added documentation section explaining container visibility feature and usage examples
despatma-dependency-container/tests/expand/visibility.rs Added test cases covering all visibility modifiers (private, pub, pub(crate), pub(self), pub(super), pub(in path))
despatma-dependency-container/tests/expand/visibility.expanded.rs Expected macro expansion output for visibility test cases
despatma-dependency-container/src/lib.rs Updated macro entry point to parse visibility parameter and apply it to the container
despatma-dependency-container/src/input.rs Added vis field to Container struct with setter method and default Inherited visibility
despatma-dependency-container/src/processing/mod.rs Added vis field to processing Container and updated conversion logic
despatma-dependency-container/src/output.rs Added vis field to output Container and applied it to generated struct definition

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chesedo chesedo changed the title Allow changing the visibility of the generated dependency container feat(di): Allow changing the visibility of the generated dependency container Nov 15, 2025
@chesedo chesedo merged commit 0d6ca4c into main Nov 17, 2025
11 checks passed
@chesedo chesedo deleted the dependency_container_visibility branch November 17, 2025 06:13
@chesedo chesedo mentioned this pull request Nov 15, 2025
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.

Dependency container scope

2 participants