Skip to main content

is_demo/
is_demo.rs

1///////////////////////////////////////////////////////////////////////////////
2//
3// StringEncrypt WebApi interface usage example.
4//
5// In this example we will verify our activation code status.
6//
7// Version        : v1.0.0
8// Language       : Rust
9// Author         : Bartosz Wójcik
10// Project page   : https://www.stringencrypt.com
11// Web page       : https://www.pelock.com
12//
13///////////////////////////////////////////////////////////////////////////////
14
15use stringencrypt::StringEncrypt;
16
17#[tokio::main]
18async fn main() {
19    let mut string_encrypt = StringEncrypt::new("", false); // leave empty for demo mode
20
21    let result = string_encrypt.is_demo().await;
22
23    let Some(result) = result else {
24        println!("Cannot connect to the API.");
25        std::process::exit(1);
26    };
27
28    if result.demo.unwrap_or(false) {
29        println!("DEMO mode");
30    } else {
31        println!("FULL mode");
32        println!("Credits left: {}", result.credits_left.unwrap_or(0));
33    }
34
35    println!("Label max length: {}", result.label_limit.unwrap_or(0));
36    println!("String max length: {}", result.string_limit.unwrap_or(0));
37    println!("Bytes max length: {}", result.bytes_limit.unwrap_or(0));
38    println!(
39        "cmd_min / cmd_max: {} / {}",
40        result.cmd_min.unwrap_or(0),
41        result.cmd_max.unwrap_or(0)
42    );
43}