Skip to main content

Mountain/Command/Hover/Interface/
HoverResponse.rs

1#![allow(non_snake_case)]
2
3//! Outbound hover response DTO: ordered list of `HoverContent::Enum`
4//! plus an optional `Range::Struct` the hover applies to. Range is
5//! omitted in serialised form when absent.
6
7use serde::{Deserialize, Serialize};
8
9use crate::Command::Hover::Interface::{HoverContent, Range};
10
11#[derive(Debug, Clone, Serialize, Deserialize)]
12pub struct Struct {
13	pub contents:Vec<HoverContent::Enum>,
14
15	#[serde(skip_serializing_if = "Option::is_none")]
16	pub range:Option<Range::Struct>,
17}
18
19impl Default for Struct {
20	fn default() -> Self { Self { contents:Vec::new(), range:None } }
21}
22
23impl Struct {
24	pub fn new(contents:Vec<HoverContent::Enum>) -> Self { Self { contents, range:None } }
25
26	pub fn WithRange(contents:Vec<HoverContent::Enum>, range:Range::Struct) -> Self {
27		Self { contents, range:Some(range) }
28	}
29}