docs: add core module and API documentation

This commit is contained in:
Christian Visintin
2026-03-21 13:35:32 +01:00
parent eac8bf5903
commit 7fc61e1e90
6 changed files with 43 additions and 2 deletions

View File

@@ -1,3 +1,7 @@
//! ## Bookmark S3 Parameters
//!
//! Stores the bookmark-specific representation of AWS S3 connection settings.
use serde::{Deserialize, Serialize};
use crate::filetransfer::params::AwsS3Params;
@@ -5,13 +9,20 @@ use crate::filetransfer::params::AwsS3Params;
/// Connection parameters for Aws s3 protocol
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Eq, Default)]
pub struct S3Params {
/// Bucket name to open.
pub bucket: String,
/// AWS region used for the bucket.
pub region: Option<String>,
/// Custom endpoint URL for S3-compatible services.
pub endpoint: Option<String>,
/// Shared credentials profile name.
pub profile: Option<String>,
/// Static access key identifier.
pub access_key: Option<String>,
/// Static secret access key.
pub secret_access_key: Option<String>,
/// NOTE: there are no session token and security token since they are always temporary
/// Whether to force path-style bucket addressing.
pub new_path_style: Option<bool>,
}

View File

@@ -1,3 +1,7 @@
//! ## Bookmark Kube Parameters
//!
//! Stores bookmark-specific Kubernetes connection settings.
use serde::{Deserialize, Serialize};
use crate::filetransfer::params::KubeProtocolParams;
@@ -5,10 +9,15 @@ use crate::filetransfer::params::KubeProtocolParams;
/// Extra Connection parameters for Kube protocol
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Eq, Default)]
pub struct KubeParams {
/// Optional default namespace.
pub namespace: Option<String>,
/// Optional cluster API URL.
pub cluster_url: Option<String>,
/// Optional Kubernetes username override.
pub username: Option<String>,
/// Optional client certificate path.
pub client_cert: Option<String>,
/// Optional client key path.
pub client_key: Option<String>,
}

View File

@@ -1,3 +1,7 @@
//! ## Bookmark SMB Parameters
//!
//! Stores bookmark-specific SMB share configuration.
use serde::{Deserialize, Serialize};
use crate::filetransfer::params::SmbParams as TransferSmbParams;
@@ -5,7 +9,9 @@ use crate::filetransfer::params::SmbParams as TransferSmbParams;
/// Extra Connection parameters for SMB protocol
#[derive(Clone, Deserialize, Serialize, Debug, PartialEq, Eq, Default)]
pub struct SmbParams {
/// SMB share name.
pub share: String,
/// Optional SMB workgroup used on POSIX platforms.
pub workgroup: Option<String>,
}

View File

@@ -1,13 +1,19 @@
//! ## Host Bridge Builder
//!
//! Builds host bridge implementations from persisted host bridge parameters and
//! the active configuration client.
use super::{HostBridgeParams, RemoteFsBuilder};
use crate::host::{HostBridge, Localhost, RemoteBridged};
use crate::system::config_client::ConfigClient;
/// Builds the host-side filesystem bridge used during file transfer sessions.
pub struct HostBridgeBuilder;
impl HostBridgeBuilder {
/// Build Host Bridge from parms
/// Builds a host bridge from serialized parameters.
///
/// if protocol and parameters are inconsistent, the function will return an error.
/// Returns an error when the selected host protocol and parameters are inconsistent.
pub fn build(
params: HostBridgeParams,
config_client: &ConfigClient,

View File

@@ -1,3 +1,8 @@
//! ## Temp Mapped File
//!
//! Provides a temporary local file that mirrors a remote file while keeping a
//! lazily opened read/write handle.
use std::fs::File;
use std::io::{self, Read, Write};
use std::sync::{Arc, Mutex};
@@ -34,6 +39,7 @@ impl Read for TempMappedFile {
}
impl TempMappedFile {
/// Creates an empty temporary file container for a downloaded remote file.
pub fn new() -> HostResult<Self> {
NamedTempFile::new()
.map(|tempfile| TempMappedFile {

View File

@@ -23,7 +23,9 @@ pub enum UpdateStatus {
/// Info related to a github release
#[derive(Debug)]
pub struct Release {
/// Release version string returned by GitHub.
pub version: String,
/// Release notes body returned by GitHub.
pub body: String,
}
@@ -48,6 +50,7 @@ impl Update {
self
}
/// Installs the latest available release using the configured update options.
pub fn upgrade(self) -> Result<UpdateStatus, UpdateError> {
info!("Updating termscp...");
GithubUpdater::configure()