Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@
150
]
},
"rust-analyzer.cargo.features": [
"qm"
],
"rust-analyzer.cargo.cfgs": [
"!miri"
],
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,9 @@
resolver = "2"
# Split to default members without tests and examples.
# Used when executing cargo from project root.
default-members = [
"src/containers",
"src/log"
]
default-members = ["src/containers", "src/log/mw_log_fmt"]
# Include tests and examples as a member for IDE support and Bazel builds.
members = [
"src/containers",
"src/log"
]
members = ["src/containers", "src/log/mw_log_fmt"]


[workspace.package]
Expand All @@ -21,6 +15,7 @@ authors = ["S-CORE Contributors"]


[workspace.dependencies]
mw_log_fmt = { path = "src/log/mw_log_fmt" }


[workspace.lints.clippy]
Expand All @@ -30,3 +25,4 @@ alloc_instead_of_core = "warn"

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(loom)'] }
missing_docs = "warn"
10 changes: 0 additions & 10 deletions docs/module/log/architecture/_assets/interface.puml
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,12 @@ package log <<component>> {
+fmt(&self, f: &mut dyn ScoreWrite, spec: &FormatSpec) : Result
}

+interface ScoreDisplay <<trait>> {
+fmt(&self, f: &mut dyn ScoreWrite, spec: &FormatSpec) : Result
}

class mw_log_fmt <<module>> {
+write(output: &mut dyn ScoreWrite, args: Arguments<'_>) : Result

+score_write!(format_string: &str, args...) : Result
+score_writeln!(format_string: &str, args...) : Result
}

ScoreDebug -[hidden]down- ScoreDisplay
ScoreDisplay -[hidden]down- mw_log_fmt

}

mw_log -- Level
Expand All @@ -69,6 +61,4 @@ package log <<component>> {
mw_log -right- mw_log_fmt
}



@enduml
13 changes: 3 additions & 10 deletions docs/module/log/detailed_design/_assets/class_diagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,7 @@ package "mw_log_fmt crate" {
-spec: FormatSpec
-_lifetime: PhantomData<&'a ()>

+new_debug(value: &ScoreDebug, spec: FormatSpec) : Self
+new_display(value: &ScoreDisplay, spec: FormatSpec) : Self
+new(value: &ScoreDebug, spec: FormatSpec) : Self

+fmt(&self, f: &mut dyn ScoreWrite, spec: &FormatSpec) : Result
}
Expand All @@ -186,17 +185,11 @@ package "mw_log_fmt crate" {
+fmt(&self, f: &mut dyn ScoreWrite, spec: &FormatSpec) : Result
}

+interface ScoreDisplay <<trait>> {
+fmt(&self, f: &mut dyn ScoreWrite, spec: &FormatSpec) : Result
}

' Placeholders are dependent on implementations provided by "Score*" traits.
' Placeholders are dependent on "ScoreDebug" trait implementations.
Placeholder --> ScoreDebug
Placeholder --> ScoreDisplay

' All trait implementations rely on "ScoreWrite".
' Trait implementations rely on "ScoreWrite".
ScoreDebug --> ScoreWrite
ScoreDisplay --> ScoreWrite

class mw_log_fmt <<module>> {
+write(output: &mut dyn ScoreWrite, args: Arguments<'_>) : Result
Expand Down
11 changes: 3 additions & 8 deletions docs/module/log/detailed_design/_assets/log_op.puml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ end box

box #LightYellow
participant "mw_log_fmt\n<<module>>" as mw_log_fmt
participant "ConcreteType\n<<ScoreDisplay implementation>>" as score_display
participant "ConcreteType\n<<ScoreDebug implementation>>" as score_debug
end box

Expand Down Expand Up @@ -54,13 +53,9 @@ else log-level-check-passed
mw_log_fmt -> writer : write_str()
writer --> mw_log_fmt
else is-placeholder
alt display-requested
mw_log_fmt -> score_display : fmt()
score_display --> mw_log_fmt
else debug-requested
mw_log_fmt -> score_debug : fmt()
score_debug --> mw_log_fmt
end
mw_log_fmt -> score_debug : fmt()
score_debug --> mw_log_fmt

mw_log_fmt -> writer : write_<type>()
writer --> mw_log_fmt
end
Expand Down
24 changes: 0 additions & 24 deletions src/log/BUILD
Original file line number Diff line number Diff line change
@@ -1,24 +0,0 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")

rust_library(
name = "log",
srcs = glob(["src/**/*.rs"]),
visibility = ["//visibility:public"],
)

rust_test(
name = "log_tests",
crate = ":log",
)
11 changes: 0 additions & 11 deletions src/log/Cargo.toml

This file was deleted.

29 changes: 29 additions & 0 deletions src/log/mw_log_fmt/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************
load("@rules_rust//rust:defs.bzl", "rust_library", "rust_test")

rust_library(
name = "mw_log_fmt",
srcs = glob(["**/*.rs"]),
# TODO: expose required interface through `mw_log`.
visibility = ["//visibility:public"],
)

rust_test(
name = "tests",
crate = "mw_log_fmt",
tags = [
"unit_tests",
"ut",
],
)
28 changes: 28 additions & 0 deletions src/log/mw_log_fmt/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
#
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

[package]
name = "mw_log_fmt"
version.workspace = true
authors.workspace = true
readme.workspace = true
edition.workspace = true

[lib]
path = "lib.rs"

[features]
qm = []

[lints]
workspace = true
Loading
Loading