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
impl RemoteAnalyzer
Sourcepub fn set_progress_hook<H: ProgressHook + 'static>(&mut self, hook: H)
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);Sourcepub fn set_global_config(&mut self, config: ProviderConfig)
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);Sourcepub fn set_provider_config(
&mut self,
provider_name: &str,
config: ProviderConfig,
)
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);Sourcepub fn set_filter(&mut self, filter: IntelligentFilter)
pub fn set_filter(&mut self, filter: IntelligentFilter)
Sourcepub fn set_aggressive_filtering(&mut self, enabled: bool)
pub fn set_aggressive_filtering(&mut self, enabled: bool)
Enable or disable aggressive file filtering
§Arguments
enabled- Whether to enable aggressive filtering
Sourcepub fn set_timeout(&mut self, timeout: u64)
pub fn set_timeout(&mut self, timeout: u64)
Sourcepub fn set_allow_insecure(&mut self, allow_insecure: bool)
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
Sourcepub fn set_provider_credentials(
&mut self,
provider_name: &str,
credentials: HashMap<String, String>,
)
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 providercredentials- Credentials map
Sourcepub async fn analyze_url(&self, url: &str) -> Result<ProjectAnalysis>
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§
Auto Trait Implementations§
impl !RefUnwindSafe for RemoteAnalyzer
impl !UnwindSafe for RemoteAnalyzer
impl Freeze for RemoteAnalyzer
impl Send for RemoteAnalyzer
impl Sync for RemoteAnalyzer
impl Unpin for RemoteAnalyzer
impl UnsafeUnpin for RemoteAnalyzer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more