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
ab32c58d
Commit
ab32c58d
authored
1 year ago
by
Udo Eisenbarth
Browse files
Options
Downloads
Patches
Plain Diff
Use rc as underlying node...
parent
66d1e2e9
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_reference.rs
+3
-3
3 additions, 3 deletions
src/nodes/node_reference.rs
src/optic_node.rs
+6
-3
6 additions, 3 deletions
src/optic_node.rs
with
9 additions
and
6 deletions
src/nodes/node_reference.rs
+
3
−
3
View file @
ab32c58d
...
...
@@ -4,12 +4,12 @@ use crate::optic_node::{OpticNode, Optical};
/// A virtual component referring to another existing component. This node type is necessary in order to model resonators (loops) or double-pass systems.
pub
struct
NodeReference
{
reference
:
Weak
<
Optic
Node
>
,
reference
:
Rc
<
dyn
Optic
al
>
,
}
impl
NodeReference
{
pub
fn
new
(
node
:
OpticNode
)
->
Self
{
Self
{
reference
:
Rc
::
downgrade
(
&
Rc
::
new
(
node
)
)
}
pub
fn
new
(
node
:
&
OpticNode
)
->
Self
{
Self
{
reference
:
node
.node_ref
(
)
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/optic_node.rs
+
6
−
3
View file @
ab32c58d
use
std
::
fmt
::
Debug
;
use
std
::
{
fmt
::
Debug
,
rc
::
Rc
}
;
use
crate
::
optic_ports
::
OpticPorts
;
/// An [`OpticNode`] is the basic struct representing an optical component.
pub
struct
OpticNode
{
name
:
String
,
node
:
Box
<
dyn
Optical
>
,
node
:
Rc
<
dyn
Optical
>
,
ports
:
OpticPorts
}
...
...
@@ -24,7 +24,7 @@ impl OpticNode {
let
ports
=
node_type
.ports
();
Self
{
name
:
name
.into
(),
node
:
Box
::
new
(
node_type
),
node
:
Rc
::
new
(
node_type
),
ports
}
}
...
...
@@ -59,6 +59,9 @@ impl OpticNode {
pub
fn
ports
(
&
self
)
->
&
OpticPorts
{
&
self
.ports
}
pub
fn
node_ref
(
&
self
)
->
Rc
<
dyn
Optical
>
{
self
.node
.clone
()
}
}
impl
Debug
for
OpticNode
{
...
...
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