30 lines
700 B
Rust
30 lines
700 B
Rust
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
pub struct RfcRef(pub &'static str);
|
|
|
|
#[derive(Clone, Debug, PartialEq, Eq)]
|
|
pub struct Warning {
|
|
pub message: String,
|
|
pub rfc_refs: Vec<RfcRef>,
|
|
pub context: Option<String>,
|
|
}
|
|
|
|
impl Warning {
|
|
pub fn new(message: impl Into<String>) -> Self {
|
|
Self {
|
|
message: message.into(),
|
|
rfc_refs: Vec::new(),
|
|
context: None,
|
|
}
|
|
}
|
|
|
|
pub fn with_rfc_refs(mut self, refs: &[RfcRef]) -> Self {
|
|
self.rfc_refs.extend_from_slice(refs);
|
|
self
|
|
}
|
|
|
|
pub fn with_context(mut self, context: impl Into<String>) -> Self {
|
|
self.context = Some(context.into());
|
|
self
|
|
}
|
|
}
|