Skip to content

Commit 4ac3479

Browse files
committed
Refactor string formatting in examples and library to use new syntax for better readability
1 parent 4183b04 commit 4ac3479

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

examples/basic_usage.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
2020

2121
println!("Building image URL...");
2222
let image_url = capture.build_image_url("https://capture.page/", Some(&options))?;
23-
println!("Image URL: {}", image_url);
23+
println!("Image URL: {image_url}");
2424

2525
println!("Building PDF URL...");
2626
let pdf_url = capture.build_pdf_url("https://capture.page/", Some(&options))?;
27-
println!("PDF URL: {}", pdf_url);
27+
println!("PDF URL: {pdf_url}");
2828

2929
println!("Fetching image...");
3030
let image_data = capture

examples/builder_pattern.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
1717
let capture = Capture::with_options(api_key.clone(), api_secret.clone(), options);
1818

1919
let image_url = capture.build_image_url("https://capture.page/", None)?;
20-
println!("Image URL with edge: {}", image_url);
20+
println!("Image URL with edge: {image_url}");
2121

2222
// Example 2: Using builder pattern directly on Capture
2323
println!("\nExample 2: Builder pattern on Capture struct");
@@ -26,7 +26,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
2626
.with_timeout(Duration::from_secs(15));
2727

2828
let pdf_url = capture.build_pdf_url("https://capture.page/", None)?;
29-
println!("PDF URL with edge and timeout: {}", pdf_url);
29+
println!("PDF URL with edge and timeout: {pdf_url}");
3030

3131
// Example 3: Custom HTTP client
3232
println!("\nExample 3: Custom HTTP client");
@@ -38,7 +38,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
3838
let capture = Capture::new(api_key.clone(), api_secret.clone()).with_client(custom_client);
3939

4040
let content_url = capture.build_content_url("https://capture.page/", None)?;
41-
println!("Content URL with custom client: {}", content_url);
41+
println!("Content URL with custom client: {content_url}");
4242

4343
// Example 4: Chaining multiple configurations
4444
println!("\nExample 4: Chaining multiple configurations");
@@ -71,7 +71,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
7171
);
7272

7373
let metadata_url = capture.build_metadata_url("https://capture.page/", None)?;
74-
println!("Metadata URL with complex setup: {}", metadata_url);
74+
println!("Metadata URL with complex setup: {metadata_url}");
7575

7676
Ok(())
7777
}

examples/edge_usage.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
3535

3636
println!("Building image URL with edge...");
3737
let image_url = capture.build_image_url("https://capture.page/", Some(&request_options))?;
38-
println!("Image URL: {}", image_url);
38+
println!("Image URL: {image_url}");
3939

4040
println!("Fetching image via edge...");
4141
let image_data = capture

examples/structured_options.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
2626
println!("Building screenshot URL with structured options...");
2727
let screenshot_url =
2828
capture.build_screenshot_url("https://capture.page/", Some(&screenshot_options))?;
29-
println!("Screenshot URL: {}", screenshot_url);
29+
println!("Screenshot URL: {screenshot_url}");
3030

3131
// Example 2: PDF with structured options
3232
let pdf_options = PdfOptions {
@@ -42,7 +42,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
4242

4343
println!("Building PDF URL with structured options...");
4444
let pdf_url = capture.build_pdf_url_structured("https://capture.page/", Some(&pdf_options))?;
45-
println!("PDF URL: {}", pdf_url);
45+
println!("PDF URL: {pdf_url}");
4646

4747
// Example 3: Content with structured options
4848
let content_options = ContentOptions {
@@ -54,7 +54,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
5454
println!("Building content URL with structured options...");
5555
let content_url =
5656
capture.build_content_url_structured("https://capture.page/", Some(&content_options))?;
57-
println!("Content URL: {}", content_url);
57+
println!("Content URL: {content_url}");
5858

5959
// Example 4: Using generic override mechanism
6060
let mut additional_options = HashMap::new();
@@ -78,7 +78,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
7878
println!("Building screenshot URL with override options...");
7979
let override_url =
8080
capture.build_screenshot_url("https://capture.page/", Some(&screenshot_with_override))?;
81-
println!("Override URL: {}", override_url);
81+
println!("Override URL: {override_url}");
8282

8383
// Example 5: Metadata with generic options only
8484
let mut metadata_additional = HashMap::new();
@@ -94,7 +94,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
9494
println!("Building metadata URL with generic options...");
9595
let metadata_url =
9696
capture.build_metadata_url_structured("https://capture.page/", Some(&metadata_options))?;
97-
println!("Metadata URL: {}", metadata_url);
97+
println!("Metadata URL: {metadata_url}");
9898

9999
// Example 6: Fetch screenshot with structured options
100100
println!("Fetching screenshot with structured options...");

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ impl Capture {
518518
}
519519

520520
fn generate_token(&self, secret: &str, url: &str) -> String {
521-
format!("{:x}", md5::compute(format!("{}{}", secret, url)))
521+
format!("{:x}", md5::compute(format!("{secret}{url}")))
522522
}
523523

524524
fn to_query_string(&self, options: &RequestOptions) -> String {

0 commit comments

Comments
 (0)