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	#[serde(skip_serializing_if = "Option::is_none")]
15	pub range:Option<Range::Struct>,
16}
17
18impl Default for Struct {
19	fn default() -> Self { Self { contents:Vec::new(), range:None } }
20}
21
22impl Struct {
23	pub fn new(contents:Vec<HoverContent::Enum>) -> Self { Self { contents, range:None } }
24
25	pub fn WithRange(contents:Vec<HoverContent::Enum>, range:Range::Struct) -> Self {
26		Self { contents, range:Some(range) }
27	}
28}