chore: add #[non_exhaustive] and mutation methods to improve compatibility (#715)
* chore: add #[non_exhaustive] to reduce backwards-incompatible changes going forward * fix: remove ProtocolVersion import * fix: add a few more with_ mutator methods --------- Co-authored-by: Alex Hancock <alexhancock@block.xyz>
This commit is contained in:
parent
79834b6211
commit
f63718d202
1 changed files with 1568 additions and 1110 deletions
|
|
@ -566,6 +566,7 @@ impl RunningServiceCancellationToken {
|
|||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
#[non_exhaustive]
|
||||
pub enum QuitReason {
|
||||
Cancelled,
|
||||
Closed,
|
||||
|
|
@ -584,6 +585,19 @@ pub struct RequestContext<R: ServiceRole> {
|
|||
pub peer: Peer<R>,
|
||||
}
|
||||
|
||||
impl<R: ServiceRole> RequestContext<R> {
|
||||
/// Create a new RequestContext.
|
||||
pub fn new(id: RequestId, peer: Peer<R>) -> Self {
|
||||
Self {
|
||||
ct: CancellationToken::new(),
|
||||
id,
|
||||
meta: Meta::default(),
|
||||
extensions: Extensions::default(),
|
||||
peer,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Request execution context
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct NotificationContext<R: ServiceRole> {
|
||||
|
|
|
|||
Loading…
Reference in a new issue