From 786bac2849098a5edc69a8f8cf90f7ba754276f5 Mon Sep 17 00:00:00 2001 From: Wilson Lin Date: Fri, 19 Jun 2020 14:26:39 +1000 Subject: [PATCH] Update README --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a8b2dd1..4b34400 100644 --- a/README.md +++ b/README.md @@ -52,31 +52,35 @@ hyperbuild = "0.1.1" ##### Use ```rust -use hyperbuild::hyperbuild; +use hyperbuild::{FriendlyError, hyperbuild}; fn main() { let mut code = b"

Hello, world!

".to_vec(); - // `hyperbuild` minifies a slice in-place and returns the new minified length, but leaves any original code after the minified code intact. + // Minifies a slice in-place and returns the new minified length, + // but leaves any original code after the minified code intact. match hyperbuild(&mut code) { Ok(minified_len) => {} Err((error_type, error_position)) => {} }; - // `hyperbuild_copy` creates a vector copy containing only minified code instead of minifying in-place. + // Creates a vector copy containing only minified code + // instead of minifying in-place. match hyperbuild_copy(&code) { Ok(minified) => {} Err((error_type, error_position)) => {} }; - // `hyperbuild_truncate` minifies a vector in-place, and then truncates the vector to the new minified length. + // Minifies a vector in-place, and then truncates the + // vector to the new minified length. match hyperbuild_truncate(&mut code) { Ok(()) => {} Err((error_type, error_position)) => {} }; - // `hyperbuild_friendly_error` is identical to `hyperbuild` except the error is a FriendlyError instead. - // `code_context` is a string of a visual representation of the source code with line numbers and position markers to aid in debugging syntax issues, and should be printed. + // Identical to `hyperbuild` except with FriendlyError instead. + // `code_context` is a string of a visual representation of the source, + // with line numbers and position markers to aid in debugging syntax. match hyperbuild_friendly_error(&mut code) { Ok(minified_len) => {} Err(FriendlyError { position, message, code_context }) => {