Skip to content

Commit

Permalink
Updating Observer doc comment formating for fbcref
Browse files Browse the repository at this point in the history
Summary: fbcref expects code examples to have 4 leading spaces to be identified as pre/code blocks

Reviewed By: Gownta

Differential Revision: D68038199

fbshipit-source-id: c5111a9a3fc1118d9b340adaf4126341b2f58e4f
  • Loading branch information
skrueger authored and facebook-github-bot committed Jan 14, 2025
1 parent 2d7e7e6 commit 454c3f2
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions folly/observer/Observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ namespace observer {
* Given an Observer, you can get a snapshot of the current version of the
* object it holds:
*
* Observer<int> myObserver = ...;
* Snapshot<int> mySnapshot = myObserver.getSnapshot();
* Observer<int> myObserver = ...;
* Snapshot<int> mySnapshot = myObserver.getSnapshot();
*
* or simply
* Snapshot<int> mySnapshot = *myObserver;
*
* Snapshot<int> mySnapshot = *myObserver;
*
* Snapshot will hold a view of the object, even if object in the Observer
* gets updated.
Expand All @@ -48,20 +50,20 @@ namespace observer {
* Observers. Imagine we have two separate Observers A and B which hold
* integers.
*
* Observer<int> observerA = ...;
* Observer<int> observerB = ...;
* Observer<int> observerA = ...;
* Observer<int> observerB = ...;
*
* To compute a sum of A and B we can create a new Observer which would track
* updates to A and B and re-compute the sum only when necessary.
*
* Observer<int> sumObserver = makeObserver(
* [observerA, observerB] {
* int a = **observerA;
* int b = **observerB;
* return a + b;
* });
* Observer<int> sumObserver = makeObserver(
* [observerA, observerB] {
* int a = **observerA;
* int b = **observerB;
* return a + b;
* });
*
* int sum = **sumObserver;
* int sum = **sumObserver;
*
* Notice that a + b will be only called when either a or b is changed. Getting
* a snapshot from sumObserver won't trigger any re-computation.
Expand Down

0 comments on commit 454c3f2

Please sign in to comment.