FrameworkDetector

Struct FrameworkDetector 

Source
pub struct FrameworkDetector;
Expand description

Framework detector for identifying web frameworks used in a Rust project.

The FrameworkDetector analyzes parsed Rust files to automatically detect which web frameworks are being used. It does this by examining use statements for framework-specific imports.

Currently supports detection of:

  • Axum (via use axum::...)
  • Actix-Web (via use actix_web::...)

Implementations§

Source§

impl FrameworkDetector

Source

pub fn detect(parsed_files: &[ParsedFile]) -> DetectionResult

Detects web frameworks used in the provided parsed files.

This method scans all use statements in the parsed files to identify framework imports. Multiple frameworks can be detected if the project uses more than one.

§Arguments
  • parsed_files - Slice of successfully parsed Rust files to analyze
§Returns

Returns a DetectionResult containing all detected frameworks.

§Example
use openapi_from_source::detector::FrameworkDetector;
use openapi_from_source::parser::AstParser;
use std::path::Path;

let parsed = AstParser::parse_file(Path::new("src/main.rs")).unwrap();
let result = FrameworkDetector::detect(&[parsed]);
println!("Detected {} framework(s)", result.frameworks.len());

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.