1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
//! This crate implement `liberty` data structre in Rust.
//! <script>
//! IFRAME('https://zao111222333.github.io/liberty-db/2020.09/reference_manual.html');
//! </script>
#![doc(
// The following are document setting according to
// https://doc.rust-lang.org/rustdoc/write-documentation/the-doc-attribute.html
// For html-pdf-viewer setting:
// https://tinytip.co/tips/html-pdf-params/
// html_favicon_url = "https://example.com/favicon.ico",
// html_logo_url = "https://example.com/logo.jpg",
html_playground_url = "https://play.rust-lang.org",
)]
// #![cfg_attr(
// feature = "nightly",
// feature(
// test,
// core_intrinsics,
// dropck_eyepatch,
// min_specialization,
// extend_one,
// allocator_api,
// slice_ptr_get,
// nonnull_slice_from_raw_parts,
// maybe_uninit_array_assume_init,
// build_hasher_simple_hash_one
// )
// )]
#![deny(
// The following are allowed by default lints according to
// https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html
anonymous_parameters,
bare_trait_objects,
// box_pointers,
elided_lifetimes_in_paths, // allow anonymous lifetime
missing_debug_implementations,
// missing_docs, // TODO: add documents
// trivial_casts, // TODO: remove trivial casts in code
trivial_numeric_casts,
// unsafe_code,
unstable_features,
unused_extern_crates,
unused_import_braces,
unreachable_pub, // allow clippy::redundant_pub_crate lint instead
// unused_qualifications,
unused_results, // TODO: fix unused results
variant_size_differences,
// warnings, // treat all wanings as errors
clippy::all,
clippy::restriction,
clippy::pedantic,
clippy::nursery,
clippy::cargo
)]
#![allow(
// Some explicitly allowed Clippy lints, must have clear reason to allow
clippy::blanket_clippy_restriction_lints, // allow clippy::restriction
clippy::implicit_return, // actually omitting the return keyword is idiomatic Rust code
clippy::module_name_repetitions, // repeation of module name in a struct name is not big deal
clippy::multiple_crate_versions, // multi-version dependency crates is not able to fix
clippy::panic, // allow debug_assert, panic in production code
clippy::panic_in_result_fn,
clippy::missing_errors_doc, // TODO: add error docs
clippy::exhaustive_structs,
clippy::exhaustive_enums,
clippy::missing_panics_doc, // TODO: add panic docs
clippy::panic_in_result_fn,
clippy::print_stdout,
clippy::use_debug
)]
#![warn(
clippy::todo,
dead_code,
missing_copy_implementations, // Copy may cause unnecessary memory copy
missing_docs,
single_use_lifetimes, // TODO: fix lifetime names only used once
unused_qualifications,
)]
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate log;
// #[macro_use] extern crate prettytable;
pub use mut_set::MutSet as GroupSet;
/// `bundle` group structure.
pub mod bundle;
/// `bus` group structure.
pub mod bus;
/// `cell` group structure.
pub mod cell;
pub use cell::Cell;
/// Common items/miscs.
pub mod common;
/// `Boolean Expression`, `SDF Expression`, and so on.
pub mod expression;
/// `internal_power` group structure.
pub mod internal_power;
/// `Library` group structure, top level of liberty format.
pub mod library;
pub use library::Library;
/// `pin` group structure.
pub mod pin;
pub use pin::Pin;
/// `timing` group structure.
pub mod timing;
/// Partially re-exported [uom](https://crates.io/crates/uom) quantities and measurement units
/// used in the library public interface.
pub mod units;
pub mod ast;
mod ccsn;
mod types;
mod util;
mod test {
use std::{str::FromStr, string};
struct A(String);
impl FromStr for A {
type Err = std::fmt::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(Self(s.to_string()))
}
}
struct B(String);
impl FromStr for B {
type Err = std::fmt::Error;
fn from_str(s: &str) -> Result<Self, Self::Err> {
Ok(Self(s.to_string()))
}
}
struct MyStruct {
a: A,
b: B,
}
// fn xxx(){
// use std::collections::HashMap;
// let mut parsers = HashMap::new();
// let _ = parsers.insert('k', A::from_str);
// let _ = parsers.insert('x', B::from_str);
// }
}