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

feat: improve sink SDK experience #29

Merged
merged 8 commits into from
Feb 19, 2024
Merged

feat: improve sink SDK experience #29

merged 8 commits into from
Feb 19, 2024

Conversation

vigith
Copy link
Member

@vigith vigith commented Feb 15, 2024

No description provided.

Signed-off-by: Vigith Maurice <[email protected]>
@vigith vigith changed the title feat: improve Sink SDK experience feat: improve sink SDK experience Feb 15, 2024
@vigith vigith requested a review from BulkBeing February 15, 2024 04:43
success: true,
err: "".to_string(),
}
struct Logger {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

For 'empty' struct, we can use unit struct:

struct Logger;

// value is same
sink::Server::new(Logger).start().await

src/map.rs Outdated
@@ -127,7 +127,7 @@ pub struct Server<T> {
map_svc: Option<T>,
}

impl<T> Server<T> {
impl<T: Mapper> Server<T> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

In Rust, usually trait bounds are specified at the locations where it is needed. Here, it would be the start and start_with_shutdown methods. If we are moving the trait bounds to full implementation block itself, let's remove it from the where clause of those methods and make T: Mapper + Send + Sync + 'static

src/sink.rs Outdated
@@ -29,43 +32,37 @@ pub trait Sinker {
/// A simple log sink.
///
/// ```rust,ignore
Copy link
Collaborator

@BulkBeing BulkBeing Feb 18, 2024

Choose a reason for hiding this comment

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

Let's make this

```no_run

to ensure code is valid and compiles.

Also, a few lines above, the doc comment still refers to the old Datum struct

/// The sink handle is given a stream of [`Datum`].

Signed-off-by: Vigith Maurice <[email protected]>
Signed-off-by: Vigith Maurice <[email protected]>
Signed-off-by: Vigith Maurice <[email protected]>
Signed-off-by: Vigith Maurice <[email protected]>
Signed-off-by: Vigith Maurice <[email protected]>
@vigith vigith enabled auto-merge (squash) February 19, 2024 05:26
@vigith vigith merged commit 4e2764a into main Feb 19, 2024
2 checks passed
@vigith vigith deleted the sink branch February 19, 2024 05:26
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.

2 participants