refactor(kernel): rename ParamDoc to Documentation

This commit is contained in:
Orhun Parmaksız 2021-10-18 00:40:38 +03:00
parent 146ec1bba9
commit 507c6ee063
No known key found for this signature in database
GPG Key ID: F83424824B3E4B90
2 changed files with 6 additions and 6 deletions

View File

@ -48,7 +48,7 @@ impl SysctlSection {
/// Documentation of a kernel parameter.
#[derive(Clone, Debug)]
pub struct ParamDoc {
pub struct Documentation {
/// Name of the kernel parameter.
pub name: String,
/// Description of the kernel parameter.
@ -57,7 +57,7 @@ pub struct ParamDoc {
pub section: SysctlSection,
}
impl ParamDoc {
impl Documentation {
/// Constructs a new instance.
pub fn new(name: String, description: String, section: SysctlSection) -> Self {
Self {

View File

@ -3,7 +3,7 @@
use crate::title::Title;
use pest::Parser;
use std::convert::TryFrom;
use systeroid_core::docs::{ParamDoc, SysctlSection};
use systeroid_core::docs::{Documentation, SysctlSection};
use systeroid_core::error::{Error, Result};
/// Parser for the reStructuredText format.
@ -14,8 +14,8 @@ pub struct RstParser;
impl RstParser {
/// Parses the given reStructuredText input and returns the [`documentation`] of kernel parameters.
///
/// [`documentation`]: ParamDoc
pub fn parse_docs(input: &str, section: SysctlSection) -> Result<Vec<ParamDoc>> {
/// [`documentation`]: Documentation
pub fn parse_docs(input: &str, section: SysctlSection) -> Result<Vec<Documentation>> {
let mut param_docs = Vec::new();
let rst_document =
Self::parse(Rule::document, input).map_err(|e| Error::ParseError(e.to_string()))?;
@ -23,7 +23,7 @@ impl RstParser {
.filter_map(|pair| Title::try_from(pair).ok())
.collect::<Vec<Title<'_>>>();
for (i, title) in titles.iter().enumerate() {
param_docs.push(ParamDoc::new(
param_docs.push(Documentation::new(
title.value.to_string(),
if let Some(next_title) = titles.get(i + 1) {
(input[title.end_pos..next_title.start_pos])