fix typos in rust api documentation

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
Maximiliano Sandoval 2024-07-18 15:05:31 +02:00 committed by Thomas Lamprecht
parent a50d2c715e
commit 72ab48eb55
30 changed files with 48 additions and 48 deletions

View File

@ -180,7 +180,7 @@ impl CachedUserInfo {
(privs, propagated_privs)
}
/// Checks whether the `auth_id` has any of the privilegs `privs` on any object below `path`.
/// Checks whether the `auth_id` has any of the privileges `privs` on any object below `path`.
pub fn any_privs_below(
&self,
auth_id: &Authid,

View File

@ -284,7 +284,7 @@ impl CertificateRevocation<'_> {
/// creation request can be created via the [`request`](AccountCreator::request()) method, giving
/// it a nonce and a directory. This can be repeated, if necessary, like when the nonce fails.
///
/// When the server sends a succesful response, it should be passed to the
/// When the server sends a successful response, it should be passed to the
/// [`response`](AccountCreator::response()) method to finish the creation of an [`Account`] which
/// can then be persisted.
#[derive(Default)]
@ -297,7 +297,7 @@ pub struct AccountCreator {
}
impl AccountCreator {
/// Replace the contact infor with the provided ACME compatible data.
/// Replace the contact info with the provided ACME compatible data.
pub fn set_contacts(mut self, contact: Vec<String>) -> Self {
self.contact = contact;
self

View File

@ -76,7 +76,7 @@ pub enum ChallengeStatus {
/// The challenge is pending and has not been validated yet.
Pending,
/// The valiation is in progress.
/// The validation is in progress.
Processing,
/// The challenge was successfully validated.

View File

@ -22,7 +22,7 @@ pub enum Error {
/// the user has to agree to the new terms.
UserActionRequired(String),
/// Other error repsonses from the Acme API not handled specially.
/// Other error responses from the Acme API not handled specially.
Api(crate::request::ErrorResponse),
/// The Acme API behaved unexpectedly.

View File

@ -95,7 +95,7 @@ pub struct AccountData {
#[serde(skip_serializing_if = "Option::is_none")]
pub orders: Option<String>,
/// The acccount's contact info.
/// The account's contact info.
///
/// This usually contains a `"mailto:<email address>"` entry but may also contain some other
/// data if the server accepts it.

View File

@ -526,7 +526,7 @@ impl SchemaObject {
}
}
/// Check whether ther are any kind of fields defined in the struct, regardless of whether
/// Check whether there are any kind of fields defined in the struct, regardless of whether
/// they're flattened or not.
#[inline]
pub fn is_empty(&self) -> bool {

View File

@ -137,7 +137,7 @@ impl Parse for FieldName {
}
/// Most of our schema definition consists of a json-like notation.
/// For parsing we mostly just need to destinguish between objects and non-objects.
/// For parsing we mostly just need to distinguish between objects and non-objects.
/// For specific expression types we match on the contained expression later on.
// FIXME: Expr(Box<syn::Expr>)
#[allow(clippy::large_enum_variant)]

View File

@ -50,7 +50,7 @@ serde_plain::derive_fromstr_from_deserialize!(APTRepositoryPackageType);
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "PascalCase")] // for consistency
/// Additional options for an APT repository.
/// Used for both single- and mutli-value options.
/// Used for both single- and multi-value options.
pub struct APTRepositoryOption {
/// Option key.
pub key: String,
@ -223,7 +223,7 @@ pub struct APTRepositoryInfo {
#[serde(default, skip_serializing_if = "String::is_empty")]
pub path: String,
/// Index of the associated respository within the file (starting from 0).
/// Index of the associated repository within the file (starting from 0).
pub index: usize,
/// The property from which the info originates (e.g. "Suites")

View File

@ -46,7 +46,7 @@ pub type Architecture = String;
pub type Component = String;
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
/// Type of file reference extraced from path.
/// Type of file reference extracted from path.
///
/// `Packages` and `Sources` will contain further reference to binary or source package files.
/// These are handled in `PackagesFile` and `SourcesFile` respectively.

View File

@ -229,7 +229,7 @@ enum VerificationKey {
/// A key ring for authentication.
///
/// This can hold one active signing key for new tickets (either an HMAC secret or an assymmetric
/// This can hold one active signing key for new tickets (either an HMAC secret or an asymmetric
/// key), and optionally multiple public keys and HMAC secrets for verifying them in order to
/// support key rollover.
pub struct Keyring {

View File

@ -36,7 +36,7 @@ pub trait HttpApiClient {
/// `POST` request with a path and query component (no hostname), and a serializable body.
///
/// The body should be serialized to json and sent with `Content-type: applicaion/json`.
/// The body should be serialized to json and sent with `Content-type: application/json`.
///
/// For this request, authentication headers should be set!
fn post<'a, T>(&'a self, path_and_query: &'a str, params: &T) -> Self::ResponseFuture<'a>
@ -50,7 +50,7 @@ pub trait HttpApiClient {
/// `PUT` request with a path and query component (no hostname), and a serializable body.
///
/// The body should be serialized to json and sent with `Content-type: applicaion/json`.
/// The body should be serialized to json and sent with `Content-type: application/json`.
///
/// For this request, authentication headers should be set!
fn put<'a, T>(&'a self, path_and_query: &'a str, params: &T) -> Self::ResponseFuture<'a>
@ -76,7 +76,7 @@ pub struct HttpApiResponse {
}
impl HttpApiResponse {
/// Expect a JSON response as returend by the `extjs` formatter.
/// Expect a JSON response as returned by the `extjs` formatter.
pub fn expect_json<T>(self) -> Result<ApiResponseData<T>, Error>
where
T: for<'de> Deserialize<'de>,

View File

@ -10,7 +10,7 @@ use tokio_openssl::SslStream;
/// Asynchronous stream, possibly encrypted and proxied
///
/// Usefule for HTTP client implementations using hyper.
/// Useful for HTTP client implementations using hyper.
pub enum MaybeTlsStream<S> {
Normal(S),
Proxied(S),

View File

@ -228,7 +228,7 @@ pub fn create_frame(
///
/// Send websocket frames to anything accepting AsyncWrite.
///
/// Note: Every write to it gets encoded as a seperate websocket frame, without any fragmentation
/// Note: Every write to it gets encoded as a separate websocket frame, without any fragmentation
/// being enforced.
///
/// Example usage:

View File

@ -10,7 +10,7 @@ use crate::vec::{self, ByteVecExt};
/// Adds some additional related functionality for types implementing [`Read`](std::io::Read).
///
/// Particularly for reading into a newly allocated buffer, appending to a `Vec<u8>` or reading
/// values of a specific endianess (types implementing [`Endian`]).
/// values of a specific endianness (types implementing [`Endian`]).
///
/// Examples:
/// ```no_run
@ -29,7 +29,7 @@ use crate::vec::{self, ByteVecExt};
/// # }
/// ```
///
/// Or for reading values of a defined representation and endianess:
/// Or for reading values of a defined representation and endianness:
///
/// ```no_run
/// # use endian_trait::Endian;
@ -77,7 +77,7 @@ pub trait ReadExt {
/// Append an exact amount of data to a vector, growing it as necessary.
fn append_exact_to_vec(&mut self, out: &mut Vec<u8>, size: usize) -> io::Result<()>;
/// Read a value with host endianess.
/// Read a value with host endianness.
///
/// This is limited to types implementing the [`Endian`] trait under the assumption that
/// this is only done for types which are supposed to be read/writable directly.
@ -187,7 +187,7 @@ pub trait ReadExt {
/// [`Endian`]: https://docs.rs/endian_trait/0.6/endian_trait/trait.Endian.html
unsafe fn read_be_value<T: Endian>(&mut self) -> io::Result<T>;
/// Read a boxed value with host endianess.
/// Read a boxed value with host endianness.
///
/// This is currently not limited to types implementing the [`Endian`] trait as in our use
/// cases we use this for types which are too big to want to always perform endian swaps

View File

@ -6,7 +6,7 @@ use endian_trait::Endian;
/// Adds some additional related functionality for types implementing [`Write`](std::io::Write).
///
/// Particularly for writing values of a specific endianess (types implementing [`Endian`]).
/// Particularly for writing values of a specific endianness (types implementing [`Endian`]).
///
/// Examples:
/// ```no_run
@ -35,7 +35,7 @@ use endian_trait::Endian;
///
/// [`Endian`]: https://docs.rs/endian_trait/0.6/endian_trait/trait.Endian.html
pub trait WriteExt {
/// Write a value with host endianess.
/// Write a value with host endianness.
///
/// This is limited to types implementing the [`Endian`] trait under the assumption that this
/// is only done for types which are supposed to be read/writable directly.

View File

@ -58,7 +58,7 @@ pub struct Config {
pub struct SearchParameters {
/// Attributes that should be retrieved
pub attributes: Vec<String>,
/// `objectclass`es of intereset
/// `objectclass`es of interest
pub user_classes: Vec<String>,
/// Custom user filter
pub user_filter: Option<String>,
@ -217,7 +217,7 @@ impl Connection {
.ok_or_else(|| format_err!("failed to retrieve root DSE attribute '{attr}'"))
}
/// Retrive port from LDAP configuration, otherwise use the correct default
/// Retrieve port from LDAP configuration, otherwise use the correct default
fn port_from_config(&self) -> u16 {
self.config.port.unwrap_or_else(|| {
if self.config.tls_mode == ConnectionMode::Ldaps {

View File

@ -7,7 +7,7 @@ use serde::{Deserialize, Serialize};
use crate::error::TicketError;
use crate::tfa::TfaChallenge;
/// The repsonse to a ticket call can either be a complete ticket, or a TFA challenge.
/// The response to a ticket call can either be a complete ticket, or a TFA challenge.
#[derive(Clone, Debug, Serialize, Deserialize)]
pub(crate) enum TicketResponse {
Full(Ticket),
@ -62,7 +62,7 @@ impl Ticket {
&self.data[start..(start + len)]
}
/// Thet ticket's timestamp as a UNIX epoch.
/// The ticket's timestamp as a UNIX epoch.
pub fn timestamp(&self) -> i64 {
self.timestamp
}

View File

@ -393,7 +393,7 @@ pub async fn run_async_cli_command<C: Into<CommandLineInterface>>(def: C, rpcenv
/// Helper to get arguments and invoke the command.
///
/// This is the synchrounous version of run_async_cli_command. You can
/// This is the synchronous version of run_async_cli_command. You can
/// pass an optional ``run`` function to execute async commands (else
/// async commands simply fail).
pub fn run_cli_command<C: Into<CommandLineInterface>>(
@ -437,7 +437,7 @@ where
/// Helper to get arguments and invoke the command.
///
/// This is the synchrounous version of run_async_cli_command. You can
/// This is the synchronous version of run_async_cli_command. You can
/// pass an optional ``run`` function to execute async commands (else
/// async commands simply fail).
pub fn run_cli_command_with_args<A, C>(

View File

@ -7,7 +7,7 @@ use proxmox_schema::ApiType;
use crate::{RpcEnvironment, RpcEnvironmentType};
/// `RpcEnvironmet` implementation for command line tools
/// `RpcEnvironment` implementation for command line tools
#[derive(Default)]
pub struct CliEnvironment {
result_attributes: Value,

View File

@ -6,11 +6,11 @@ use unicode_width::UnicodeWidthStr;
use proxmox_schema::{ObjectSchemaType, OneOfSchema, Schema, SchemaPropertyEntry};
/// allows to configure the default output fromat using environment vars
/// allows to configure the default output format using environment vars
pub const ENV_VAR_PROXMOX_OUTPUT_FORMAT: &str = "PROXMOX_OUTPUT_FORMAT";
/// if set, supress borders (and headers) when printing tables
/// if set, suppress borders (and headers) when printing tables
pub const ENV_VAR_PROXMOX_OUTPUT_NO_BORDER: &str = "PROXMOX_OUTPUT_NO_BORDER";
/// if set, supress headers when printing tables
/// if set, suppress headers when printing tables
pub const ENV_VAR_PROXMOX_OUTPUT_NO_HEADER: &str = "PROXMOX_OUTPUT_NO_HEADER";
/// Helper to get output format from parameters or environment

View File

@ -1,4 +1,4 @@
//! Module to generate and format API Documenation
//! Module to generate and format API Documentation
use std::io::Write;
@ -41,7 +41,7 @@ fn dump_method_definition(method: &str, path: &str, def: Option<&ApiMethod>) ->
}
}
/// Generate ReST Documentaion for a complete API defined by a ``Router``.
/// Generate ReST Documentation for a complete API defined by a ``Router``.
pub fn dump_api(
output: &mut dyn Write,
router: &crate::Router,

View File

@ -1,4 +1,4 @@
//! Module to generate and format API Documenation
//! Module to generate and format API Documentation
use anyhow::{bail, Error};
@ -134,7 +134,7 @@ fn get_simple_type_text(schema: &Schema, list_enums: bool) -> String {
}
}
/// Generate ReST Documentaion for object properties
/// Generate ReST Documentation for object properties
pub fn dump_properties(
param: &dyn ObjectSchemaType,
indent: &str,
@ -424,7 +424,7 @@ fn get_object_type_text(object_schema: &ObjectSchema) -> String {
type_text
}
/// Generate ReST Documentaion for enumeration.
/// Generate ReST Documentation for enumeration.
pub fn dump_enum_properties(schema: &Schema) -> Result<String, Error> {
let mut res = String::new();

View File

@ -1,6 +1,6 @@
//! Data types to decscribe data types.
//!
//! This is loosly based on JSON Schema, but uses static rust data types. This way we can build
//! This is loosely based on JSON Schema, but uses static rust data types. This way we can build
//! completely static API definitions that can be included within the programs read-only text
//! segment.
@ -1403,7 +1403,7 @@ impl EnumEntry {
/// Use a schema to describe complex types encoded as string.
///
/// Arrays are parsed as comma separated lists, i.e: `"1,2,3"`. The
/// list may be sparated by comma, semicolon or whitespace.
/// list may be separated by comma, semicolon or whitespace.
///
/// Objects are parsed as comma (or semicolon) separated `key=value` pairs, i.e:
/// `"prop1=2,prop2=test"`. Any whitespace is trimmed from key and value.

View File

@ -1221,7 +1221,7 @@ sync: fail
assert!(config.parse(filename, raw).is_err());
}
/// Generate ReST Documentaion for ``SectionConfig``
/// Generate ReST Documentation for ``SectionConfig``
pub fn dump_section_config(config: &SectionConfig) -> String {
let mut res = String::new();

View File

@ -35,7 +35,7 @@ struct crypt_data {
internal: [libc::c_char; CRYPT_DATA_INTERNAL_SIZE],
}
/// Encrypt a pasword - see man crypt(3)
/// Encrypt a password - see man crypt(3)
pub fn crypt(password: &[u8], salt: &[u8]) -> Result<String, Error> {
#[link(name = "crypt")]
extern "C" {
@ -142,7 +142,7 @@ pub fn crypt_gensalt(prefix: &str, count: u64, rbytes: &[u8]) -> Result<String,
Ok(res.to_str()?.to_string())
}
/// Encrypt a pasword using sha256 hashing method
/// Encrypt a password using sha256 hashing method
pub fn encrypt_pw(password: &str) -> Result<String, Error> {
// 8*32 = 256 bits security (128+ recommended, see `man crypt(5)`)
let salt = crate::linux::random_data(32)?;

View File

@ -38,7 +38,7 @@ unsafe fn pidfd_send_signal(
libc::syscall(SYS_pidfd_send_signal, pidfd, sig, info, flags)
}
/// File descriptor refernce to a process.
/// File descriptor reference to a process.
pub struct PidFd {
fd: OwnedFd,
pid: Pid,

View File

@ -753,7 +753,7 @@ pub fn read_loadavg() -> Result<Loadavg, Error> {
Loadavg::read()
}
/// Load avarage: floating point values for 1, 5 and 15 minutes of runtime.
/// Load average: floating point values for 1, 5 and 15 minutes of runtime.
#[derive(Clone, Debug)]
pub struct Loadavg(pub f64, pub f64, pub f64);

View File

@ -314,7 +314,7 @@ impl TimeoutBlockGuard {
}
/// Unblock the timeout signal for the current thread. By default we block the
/// signal this behavior should be restored when done using timeouts, therefor this
/// signal this behavior should be restored when done using timeouts, therefore this
/// returns a guard:
#[inline(always)]
pub fn unblock_timeout_signal() -> TimeoutBlockGuard {

View File

@ -94,7 +94,7 @@ pub fn epoch_i64() -> i64 {
/// Returns Unix Epoch (now) as f64 with subseconds resolution
///
/// Note: This can be inacurrate for values greater the 2^53. But this
/// Note: This can be inaccurate for values greater the 2^53. But this
/// should never happen.
pub fn epoch_f64() -> f64 {
use std::time::{SystemTime, UNIX_EPOCH};

View File

@ -44,7 +44,7 @@ fn hex_digit(b: u8) -> Result<u8, UuidError> {
///
/// let uuid = Uuid::generate();
/// println!("Generated uuid: {}", uuid);
/// // prints somethign like:
/// // prints something like:
/// // Generated uuid: 65b85639-78d7-4330-85c6-39502b2f9b01
///
/// let bytes: &[u8] = uuid.as_ref();