Skip to main content

format_source

Function format_source 

Source
pub fn format_source(source: &str) -> FmtResult
Expand description

Formats a single Rust source file by reformatting all euv macro invocations.

Scans the source code for html!, class!, vars!, and watch! macro calls, then applies formatting rules to their token bodies:

  • Tag name and { separated by exactly one space
  • Attribute name immediately followed by :, then one space before the value
  • if { expr } with single spaces around each token
  • match { expr } with proper alignment
  • for pattern in { expr } with proper alignment
  • => in watch! macros with proper spacing

§Arguments

  • &str - The Rust source code content.

§Returns

  • FmtResult - The formatting result indicating whether changes were made.