diff --git a/Cargo.toml b/Cargo.toml index 08424accc..5594293a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,4 +1,8 @@ - +# These settings are present to demonstrate minimal binary size in release mode. Don't forget to strip the executable +# too. +[profile.release] +opt-level = 'z' +lto = true panic = 'abort' [workspace] diff --git a/lib/src/server/address_space/address_space.rs b/lib/src/server/address_space/address_space.rs index 1fcde7b04..00c111d1a 100644 --- a/lib/src/server/address_space/address_space.rs +++ b/lib/src/server/address_space/address_space.rs @@ -26,9 +26,9 @@ use super::super::{ callbacks, constants, diagnostics::ServerDiagnostics, historical::HistoryServerCapabilities, + session::SessionManager, state::ServerState, }; -use crate::session::SessionManager; /// Finds a node in the address space and coerces it into a reference of the expected node type. macro_rules! find_node { diff --git a/lib/src/server/address_space/data_type.rs b/lib/src/server/address_space/data_type.rs index ce708e8ed..ab432a1b7 100644 --- a/lib/src/server/address_space/data_type.rs +++ b/lib/src/server/address_space/data_type.rs @@ -6,7 +6,7 @@ use crate::types::service_types::DataTypeAttributes; -use crate::address_space::{base::Base, node::Node, node::NodeBase}; +use super::{base::Base, node::Node, node::NodeBase}; node_builder_impl!(DataTypeBuilder, DataType); diff --git a/lib/src/server/address_space/method.rs b/lib/src/server/address_space/method.rs index a9d896d8b..f1c37333c 100644 --- a/lib/src/server/address_space/method.rs +++ b/lib/src/server/address_space/method.rs @@ -8,16 +8,15 @@ use std::sync::{Arc, RwLock}; use crate::types::service_types::{Argument, MethodAttributes}; -use crate::{ - address_space::{ - address_space::MethodCallback, - base::Base, - node::{Node, NodeBase}, - variable::VariableBuilder, - }, - session::SessionManager, +use super::{ + address_space::MethodCallback, + base::Base, + node::{Node, NodeBase}, + variable::VariableBuilder, }; +use super::super::session::SessionManager; + node_builder_impl!(MethodBuilder, Method); node_builder_impl_component_of!(MethodBuilder); node_builder_impl_generates_event!(MethodBuilder); diff --git a/lib/src/server/address_space/node.rs b/lib/src/server/address_space/node.rs index 31377ca17..36a0532ec 100644 --- a/lib/src/server/address_space/node.rs +++ b/lib/src/server/address_space/node.rs @@ -7,7 +7,7 @@ use crate::types::{ NodeId, NumericRange, QualifiedName, TimestampsToReturn, Variant, WriteMask, }; -use crate::address_space::types::{ +use super::types::{ DataType, Method, Object, ObjectType, ReferenceType, Variable, VariableType, View, }; diff --git a/lib/src/server/session_diagnostics.rs b/lib/src/server/session_diagnostics.rs index b417de4ae..0dd2f7113 100644 --- a/lib/src/server/session_diagnostics.rs +++ b/lib/src/server/session_diagnostics.rs @@ -2,7 +2,7 @@ use std::collections::HashMap; use crate::types::{node_ids::ObjectTypeId, service_types::ServiceCounterDataType}; -use super::super::{ +use super::{ address_space::{address_space::AddressSpace, object::ObjectBuilder}, session::Session, }; diff --git a/tools/schema/gen_address_space.js b/tools/schema/gen_address_space.js index 0d893886e..f08e8f848 100644 --- a/tools/schema/gen_address_space.js +++ b/tools/schema/gen_address_space.js @@ -60,7 +60,8 @@ let config = { max_nodes_per_file: MAX_NODES_PER_FILE, autogenerated_by: "tools/schema/gen_address_space.js", trace: trace, - copyright: true + copyright: true, + opcua_server_crate: true } let modules = []; diff --git a/tools/schema/types.js b/tools/schema/types.js index b12f7789b..d6073defb 100644 --- a/tools/schema/types.js +++ b/tools/schema/types.js @@ -303,8 +303,10 @@ function generate_enum_types(bsd_file, enums, rs_types_dir) { #![allow(unused_attributes)] #![allow(non_upper_case_globals)] use std::io::{Read, Write}; -use crate::encoding::*; -use crate::status_codes::StatusCode; +use crate::types::{ + encoding::*, + status_codes::StatusCode, +}; use bitflags; `; @@ -371,7 +373,7 @@ impl BinaryEncoder<${enum_type.name}> for ${enum_type.name} { function generate_type_imports(structured_types, fields_to_add, fields_to_hide, has_message_info) { let imports = `#[allow(unused_imports)] -use crate::{ +use crate::types::{ encoding::*, basic_types::*, `;