Skip to content

Commit

Permalink
Merge branch 'master' into ug-add-screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
wxiaoyun authored Apr 15, 2024
2 parents 03e3a0b + 2f11361 commit ae47695
Show file tree
Hide file tree
Showing 8 changed files with 349 additions and 137 deletions.
396 changes: 271 additions & 125 deletions docs/DeveloperGuide.md

Large diffs are not rendered by default.

41 changes: 39 additions & 2 deletions docs/UserGuide.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,44 @@ nuggets of wisdom for a smooth TAPro journey.

## <i class="fa-solid fa-forward"></i> Useful Notations and Glossary

This segment aims to make your TAPro experience as smooth as silk. With these notions and terms at your fingertips, you're well on your way to becoming a TAPro power user!
This segment aims to make your TAPro experience as smooth as silk. With these notions and terms at your fingertips, pub fn new_cyclic<F>(data_fn: F) -> Rc<T>
where
F: FnOnce(&Weak<T>) -> T,

Constructs a new Rc<T> while giving you a Weak<T> to the allocation, to allow you to construct a T which holds a weak pointer to itself.

Generally, a structure circularly referencing itself, either directly or indirectly, should not hold a strong reference to itself to prevent a memory leak. Using this function, you get access to the weak pointer during the initialization of T, before the Rc<T> is created, such that you can clone and store it inside the T.

new_cyclic first allocates the managed allocation for the Rc<T>, then calls your closure, giving it a Weak<T> to this allocation, and only afterwards completes the construction of the Rc<T> by placing the T returned from your closure into the allocation.

Since the new Rc<T> is not fully-constructed until Rc<T>::new_cyclic returns, calling upgrade on the weak reference inside your closure will fail and result in a None value.
Panics

If data_fn panics, the panic is propagated to the caller, and the temporary Weak<T> is dropped normally.
Examples

use std::rc::{Rc, Weak};

struct Gadget {
me: Weak<Gadget>,
}

impl Gadget {
/// Construct a reference counted Gadget.
fn new() -> Rc<Self> {
// `me` is a `Weak<Gadget>` pointing at the new allocation of the
// `Rc` we're constructing.
Rc::new_cyclic(|me| {
// Create the actual struct here.
Gadget { me: me.clone() }
})
}

/// Return a reference counted pointer to Self.
fn me(&self) -> Rc<Self> {
self.me.upgrade().unwrap()
}
}you're well on your way to becoming a TAPro power user!

Diving into TAPro, you'll encounter some handy notations and terms. We've decoded them here to make your journey smoother and more enjoyable.

Expand Down Expand Up @@ -357,7 +394,7 @@ The help window is resizable, so you can {{ macros.semiBold('easily reposition a

Sets the course code in question.

Course is shown at the top of the window.
The course code is shown at the top of TAPro's main window.

<box type="definition" icon=":fa-solid-spell-check:" light>

Expand Down
29 changes: 29 additions & 0 deletions docs/diagrams/CommandHistoryActivityDiagram.puml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@startuml
skin rose
skinparam ActivityFontSize 15
skinparam ArrowFontSize 12
start


:Input field is empty;

if () then ([up or down arrow key pressed])
:Retrieves previousCommand
from CommandHistory
if available;
note
previousCommand is a generic variable
representing a command from CommandHistory.
Therefore it can contain an older or nere
command depending on the current command
end note
:previousCommand fills Input field;
else ([else])
:User enters command in Input field;
endif
:User executes command;
:Command saved in CommandHistory;
:Input field is cleared;

stop
@enduml
14 changes: 7 additions & 7 deletions docs/diagrams/ModelClassDiagram.puml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ UserPrefs .up.|> ReadOnlyUserPrefs

AddressBook *--> "1" UniquePersonList
UniquePersonList --> "~* all" Person
Person *--> Name
Person *--> NusNetId
Person *--> Phone
Person *--> Email
Person *--> Major
Person *--> "*" Tag
Person *--> "*" WeekNumber
Person *---> Name
Person *---> NusNetId
Person *---> Phone
Person *---> Email
Person *---> Major
Person *---> "*" Tag
Person *---> "*" WeekNumber

Person -[hidden]up--> I
UniquePersonList -[hidden]right-> I
Expand Down
6 changes: 3 additions & 3 deletions docs/diagrams/ParserClasses.puml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ Class Prefix
Class HiddenOutside #FFFFFF
HiddenOutside ..> AddressBookParser

AddressBookParser .down.> XYZCommandParser: <<create>>
AddressBookParser .down.> XYZCommandParser: creates >

XYZCommandParser ..> XYZCommand : <<create>>
AddressBookParser ..> Command : <<use>>
XYZCommandParser ..> XYZCommand : creates >
AddressBookParser ..> Command : uses >
XYZCommandParser .up.|> Parser
XYZCommandParser ..> ArgumentMultimap
XYZCommandParser ..> ArgumentTokenizer
Expand Down
Binary file added docs/images/ug/setcrs_2101.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/ug/setcrs_error.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/ug/setcrs_successful.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ae47695

Please sign in to comment.