diff --git a/Cargo.toml b/Cargo.toml index 7278a4a..333c00a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,3 +25,6 @@ default = ["deflate", "zstd"] deflate = ["include-flate-compress/deflate"] zstd = ["include-flate-compress/zstd"] no-compression-warnings = ["include-flate-codegen/no-compression-warnings"] + +[[example]] +name = "flate" diff --git a/assets/hello-world.txt b/assets/hello-world.txt new file mode 100644 index 0000000..15c0ce8 --- /dev/null +++ b/assets/hello-world.txt @@ -0,0 +1 @@ +Hello, World!🌅 diff --git a/examples/flate.rs b/examples/flate.rs new file mode 100644 index 0000000..d88e0d0 --- /dev/null +++ b/examples/flate.rs @@ -0,0 +1,22 @@ +// include-flate +// Copyright (C) SOFe, kkent030315 +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +use include_flate::flate; + +flate!(pub static HELLO_WORLD: str from "assets/hello-world.txt" with deflate if always); + +fn main() { + println!("{}", *HELLO_WORLD); +}