Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OPOSSUM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
phelix
rust
OPOSSUM
Commits
7762c7d4
Commit
7762c7d4
authored
1 year ago
by
Udo Eisenbarth
Browse files
Options
Downloads
Patches
Plain Diff
Add node_type to Optical trait.
parent
ce3f1493
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/nodes/node_dummy.rs
+5
-2
5 additions, 2 deletions
src/nodes/node_dummy.rs
src/optic_node.rs
+12
-1
12 additions, 1 deletion
src/optic_node.rs
with
17 additions
and
3 deletions
src/nodes/node_dummy.rs
+
5
−
2
View file @
7762c7d4
use
crate
::
optic_node
::
Optical
;
/// A fake / dummy co
n
ponent without any functions. It is mainly used for development and debugging purposes.
/// A fake / dummy co
m
ponent without any functions. It is mainly used for development and debugging purposes.
pub
struct
NodeDummy
;
impl
Optical
for
NodeDummy
{
/// Returns "dummy" as node type.
fn
node_type
(
&
self
)
->
String
{
"dummy"
.into
()
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/optic_node.rs
+
12
−
1
View file @
7762c7d4
...
...
@@ -32,6 +32,10 @@ impl OpticNode {
pub
fn
to_dot
(
&
self
)
->
String
{
format!
(
"
\"
{}
\"\n
"
,
self
.name
)
}
/// Returns the concrete node type as string representation.
pub
fn
node_type
(
&
self
)
->
String
{
self
.node
.node_type
()
}
}
impl
Debug
for
OpticNode
{
...
...
@@ -39,7 +43,14 @@ impl Debug for OpticNode {
write!
(
f
,
"{}"
,
self
.name
)
}
}
pub
trait
Optical
{}
/// This trait must be implemented by all concrete optical components.
pub
trait
Optical
{
/// Return the type of the optical component (lens, filter, ...). The default implementation returns "undefined".
fn
node_type
(
&
self
)
->
String
{
"undefined"
.into
()
}
}
#[cfg(test)]
mod
test
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment