Skip to main content

RemoteAnalyzer

Struct RemoteAnalyzer 

Source
pub struct RemoteAnalyzer { /* private fields */ }
Expand description

Remote repository analyzer with comprehensive configuration support

The RemoteAnalyzer supports multiple Git hosting providers and allows extensive customization of HTTP requests, authentication, and processing behavior.

§Examples

use bytes_radar::net::{RemoteAnalyzer, ProviderConfig};

// Basic usage
let mut analyzer = RemoteAnalyzer::new();

// With custom configuration
let config = ProviderConfig::new()
    .with_timeout(120)
    .with_header("X-Custom-Header", "value")
    .with_credential("token", "your-token");

analyzer.set_global_config(config);

Implementations§

Source§

impl RemoteAnalyzer

Source

pub fn new() -> Self

Create a new analyzer with default configuration

Source

pub fn set_progress_hook<H: ProgressHook + 'static>(&mut self, hook: H)

Set a progress hook for monitoring operations

§Arguments
  • hook - Progress hook implementation
§Examples
use bytes_radar::net::{RemoteAnalyzer, ProgressHook};

struct MyHook;
impl ProgressHook for MyHook {
    fn on_download_progress(&self, downloaded: u64, total: Option<u64>) {
        println!("Downloaded: {} bytes", downloaded);
    }
    fn on_processing_start(&self, message: &str) {
        println!("Processing: {}", message);
    }
    fn on_processing_progress(&self, current: usize, total: usize) {
        println!("Progress: {}/{}", current, total);
    }
}

let mut analyzer = RemoteAnalyzer::new();
analyzer.set_progress_hook(MyHook);
Source

pub fn set_global_config(&mut self, config: ProviderConfig)

Set global configuration that applies to all providers

§Arguments
  • config - Global configuration
§Examples
use bytes_radar::net::{RemoteAnalyzer, ProviderConfig};

let config = ProviderConfig::new()
    .with_timeout(300)
    .with_user_agent("my-app/1.0.0")
    .with_header("X-API-Key", "secret");

let mut analyzer = RemoteAnalyzer::new();
analyzer.set_global_config(config);
Source

pub fn set_provider_config( &mut self, provider_name: &str, config: ProviderConfig, )

Set configuration for a specific provider

§Arguments
  • provider_name - Name of the provider (e.g., “github”, “gitlab”)
  • config - Provider-specific configuration
§Examples
use bytes_radar::net::{RemoteAnalyzer, ProviderConfig};

let github_config = ProviderConfig::new()
    .with_credential("token", "github-token")
    .with_header("Accept", "application/vnd.github.v3+json");

let mut analyzer = RemoteAnalyzer::new();
analyzer.set_provider_config("github", github_config);
Source

pub fn set_filter(&mut self, filter: IntelligentFilter)

Set file filtering configuration

§Arguments
  • filter - File filter configuration
Source

pub fn set_aggressive_filtering(&mut self, enabled: bool)

Enable or disable aggressive file filtering

§Arguments
  • enabled - Whether to enable aggressive filtering
Source

pub fn set_timeout(&mut self, timeout: u64)

Set timeout for all providers (legacy method)

§Arguments
  • timeout - Timeout in seconds
Source

pub fn set_allow_insecure(&mut self, allow_insecure: bool)

Set whether to accept invalid SSL certificates (legacy method)

§Arguments
  • allow_insecure - Whether to accept invalid certificates
Source

pub fn set_provider_credentials( &mut self, provider_name: &str, credentials: HashMap<String, String>, )

Set credentials for a specific provider (legacy method)

§Arguments
  • provider_name - Name of the provider
  • credentials - Credentials map
Source

pub async fn analyze_url(&self, url: &str) -> Result<ProjectAnalysis>

Analyze a repository from its URL

§Arguments
  • url - Repository URL or shorthand notation
§Examples
use bytes_radar::net::RemoteAnalyzer;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let analyzer = RemoteAnalyzer::new();

    // Full URLs
    let analysis = analyzer.analyze_url("https://github.com/user/repo").await?;

    // Shorthand notation
    let analysis = analyzer.analyze_url("user/repo@main").await?;

    // Direct archive
    let analysis = analyzer.analyze_url("https://example.com/project.tar.gz").await?;
     
    Ok(())
}

Trait Implementations§

Source§

impl Default for RemoteAnalyzer

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more