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

Pass context objects in filter APIs #102

Merged
merged 2 commits into from
Sep 11, 2020
Merged

Pass context objects in filter APIs #102

merged 2 commits into from
Sep 11, 2020

Conversation

iffyio
Copy link
Collaborator

@iffyio iffyio commented Sep 9, 2020

Since the objects are exposed to the filter API we would
like to be able to control how they're created so that we don't
break code whenever we e.g add new fields - for this we use
phantoms, we might also need to make the Context::new() constructors
private from the filter functions since a filter shouldn't need
to create them to begin with.

Fixes #94

Since the objects are exposed to the filter API we would
like to be able to control how they're created so that we don't
break code whenever we e.g add new fields - for this we use
phantoms, we might also need to make the `Context::new()` constructors
private from the filter functions since a filter shouldn't need
to create them to begin with.

Fixes #94
@markmandel markmandel added the kind/cleanup Refactoring code, fixing up documentation, etc label Sep 11, 2020
Copy link
Contributor

@markmandel markmandel left a comment

Choose a reason for hiding this comment

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

Awesome. Love it.

/// Contents of the received packet.
pub contents: Vec<u8>,
// Enforce using constructor to create this struct.
phantom: PhantomData<()>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Always learning new stuff 👍

@markmandel markmandel merged commit 3fd56b1 into master Sep 11, 2020
@markmandel markmandel deleted the iu/filter-contexts branch September 11, 2020 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes kind/cleanup Refactoring code, fixing up documentation, etc
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FilterChain: Arguments should be a context object, and return a response object
3 participants