### Create First Signal - C++ Source: https://github.com/tripleslash/rocket/blob/master/README.md Demonstrates the basic usage of Rocket to create and connect handlers to signals, showcasing both thread-safe and thread-unsafe implementations. The example involves connecting lambda functions to signals and invoking them. ```cpp #include int main() { rocket::signal thread_unsafe_signal; rocket::thread_safe_signal thread_safe_signal; // Connecting the first handler to our signal thread_unsafe_signal.connect([]() { std::cout << "First handler called!" << std::endl; }); // Connecting a second handler to our signal using alternative syntax thread_unsafe_signal += []() { std::cout << "Second handler called!" << std::endl; }; // Invoking the signal thread_unsafe_signal(); } // Output: // First handler called! // Second handler called! ``` -------------------------------- ### Manage Connection Lifetime with Scoped Connection Source: https://github.com/tripleslash/rocket/blob/master/README.md This example illustrates how to manage the lifetime of a connection between a Rocket signal and a slot using `rocket::scoped_connection`. It ensures that the connection is automatically disconnected when the `scoped_connection` object goes out of scope, preventing crashes when the connected object is destroyed. The example shows the app running twice, with the second run not causing issues due to proper connection management. ```cpp // [...] (See example 2) int main() { std::unique_ptr app = std::make_unique(); { std::unique_ptr logger = std::make_unique(); rocket::scoped_connection connection = app->onSuccess .connect(logger.get(), &ILogger::logMessage); app->run(); } //<-- `logger`-instance is destroyed at the end of this block //<-- The `connection`-object is also destroyed here // and therefore removed from App::onSuccess. // Run the app a second time // // This would normally cause a crash / undefined behavior because the logger // instance is destroyed at this point, but App::onSuccess still referenced it // in example 2. app->run(); } // Output: // New log message: I finished my work! ``` -------------------------------- ### Connect Class Methods to Signal - C++ Source: https://github.com/tripleslash/rocket/blob/master/README.md Illustrates connecting class methods (slots) to signals using Rocket's `scoped_connection` for automatic lifetime tracking. This example defines a `Subject` class that emits a `nameChanged` signal and an `Observer` class that connects to this signal to receive notifications. ```cpp #include #include class Subject { public: void setName(const std::string& newName) { if (name != newName) { name = newName; nameChanged(newName); } } public: rocket::signal nameChanged; private: std::string name; }; class Observer { public: Observer(Subject& subject) { // Register the `onNameChanged`-function of this object as a listener and // store the resultant connection object in the listener's connection set. // This is all your need to do for the most common case, if you want the // connection to be broken when the observer is destroyed. connections += { subject.nameChanged.connect<&Observer::onNameChanged>(this) }; } void onNameChanged(const std::string& name) { std::cout << "Subject received new name: " << name << std::endl; } private: rocket::scoped_connection_container connections; }; int main() { Subject s; Observer o{ s }; s.setName("Peter"); } // Output: // Subject received new name: Peter ``` -------------------------------- ### Get Return Values from Signal Call (C++) Source: https://github.com/tripleslash/rocket/blob/master/README.md Demonstrates how to connect a function with a different signature to a signal and retrieve its return value. The default value collector returns an optional. This example connects `std::sqrtf` to a signal expecting an `int` argument and return type. ```cpp #include #include int main() { rocket::signal signal; // The library supports argument and return type transformation between the // signal and the slots. We show this by connecting the `float sqrtf(float)` // function to a signal with an `int` argument and `int` return value. signal.connect(std::sqrtf); std::cout << "Computed value: " << *signal(16); } ``` -------------------------------- ### Connect Class Methods to Signals with Parameters (C++) Source: https://context7.com/tripleslash/rocket/llms.txt Illustrates how to define a signal with typed parameters and connect a class member function as a slot. This example uses `rocket::scoped_connection_container` to manage connections, ensuring automatic disconnection when the observer object is destroyed. ```cpp #include "rocket.hpp" #include #include class Subject { public: void setName(const std::string& newName) { if (name != newName) { name = newName; nameChanged(newName); // Emit signal } } rocket::signal nameChanged; private: std::string name; }; class Observer { public: Observer(Subject& subject) { // Connect member function with automatic disconnection on destruction connections += { subject.nameChanged.connect<&Observer::onNameChanged>(this) }; } void onNameChanged(const std::string& name) { std::cout << "Subject received new name: " << name << std::endl; } private: rocket::scoped_connection_container connections; }; int main() { Subject s; Observer o{ s }; s.setName("Peter"); // Output: // Subject received new name: Peter } ``` -------------------------------- ### Advanced Lifetime Tracking with Rocket Trackable Source: https://github.com/tripleslash/rocket/blob/master/README.md This example demonstrates advanced lifetime tracking for Rocket signal connections. By having the slot's interface inherit from `rocket::trackable`, the signal library automatically manages the connection's lifetime, disconnecting it when the slot object is destroyed. This prevents dangling connections and potential crashes, as shown when the app is run after the logger instance has been destroyed. ```cpp // [...] (See example 2) struct ILogger : rocket::trackable { virtual void logMessage(const std::string& message) = 0; }; // [...] (See example 2) int main() { std::unique_ptr app = std::make_unique(); { std::unique_ptr logger = std::make_unique(); app->onSuccess.connect(logger.get(), &ILogger::logMessage); app->run(); } //<-- `logger`-instance is destroyed at the end of this block //<-- Because `ILogger` inherits from `rocket::trackable`, the signal knows // about its destruction and will automatically disconnect the slot! // Run the app a second time // // This would normally cause a crash / undefined behavior because the logger // instance is destroyed at this point, but App::onSuccess still referenced it // in example 2. app->run(); } ``` -------------------------------- ### Timers with set_interval and set_timeout (C++) Source: https://context7.com/tripleslash/rocket/llms.txt Demonstrates scheduling periodic and one-time callback executions using timer functions integrated with the event loop. This example uses `set_interval` for recurring tasks and `set_timeout` for single executions, with support for lambda functions. It requires the Rocket library and standard C++ chrono utilities. ```cpp #include "rocket.hpp" #include #include class Application { public: void initialize() { // Periodic timer - called every 1000ms connections += { rocket::set_interval<&Application::onPeriodicUpdate>( this, std::chrono::milliseconds(1000)) }; // One-time timer - called once after 5000ms connections += { rocket::set_timeout<&Application::onDelayedAction>( this, std::chrono::milliseconds(5000)) }; // Timer with lambda connections += { rocket::set_interval([]() { std::cout << "Lambda timer tick" << std::endl; }, std::chrono::milliseconds(500)) }; updateCount = 0; } void runEventLoop() { // Dispatch timers and queued calls rocket::dispatch_queued_calls(); } private: void onPeriodicUpdate() { std::cout << "Periodic update #" << ++updateCount << std::endl; if (updateCount >= 3) { // Stop periodic timer after 3 updates rocket::current_connection().disconnect(); } } void onDelayedAction() { std::cout << "Delayed action executed" << std::endl; } rocket::scoped_connection_container connections; int updateCount; }; int main() { Application app; app.initialize(); // Run event loop for 10 seconds auto start = std::chrono::steady_clock::now(); while (std::chrono::steady_clock::now() - start < std::chrono::seconds(10)) { app.runEventLoop(); std::this_thread::sleep_for(std::chrono::milliseconds(10)); } // Expected output: // Lambda timer tick // Periodic update #1 // Lambda timer tick // Periodic update #2 // Lambda timer tick // Periodic update #3 // Lambda timer tick // Delayed action executed // ... } ``` -------------------------------- ### Connect Pure Virtual Interface Methods with Rocket Signals Source: https://github.com/tripleslash/rocket/blob/master/README.md This example demonstrates how to connect a method of a pure virtual interface implementation to a Rocket signal. It utilizes std::unique_ptr for managing object lifetimes and connects a ConsoleLogger's logMessage to the App's onSuccess signal. The output shows the message being logged after the app runs. ```cpp #include #include #include class ILogger { public: virtual void logMessage(const std::string& message) = 0; }; class ConsoleLogger : public ILogger { public: void logMessage(const std::string& message) override { std::cout << "New log message: " << message << std::endl; } }; class App { public: void run() { if (work()) { onSuccess("I finished my work!"); } } bool work() { return true; } public: rocket::signal onSuccess; }; int main() { std::unique_ptr app = std::make_unique(); std::unique_ptr logger = std::make_unique(); app->onSuccess.connect<&ILogger::logMessage>(logger.get()); app->run(); } // Output: // New log message: I finished my work! ``` -------------------------------- ### Cross-Thread Communication with Queued Connections (C++) Source: https://context7.com/tripleslash/rocket/llms.txt Implements thread-safe message passing between threads using Rocket's queued connections. It ensures that slot executions are deferred to the observer's thread, preventing race conditions. This example requires the Rocket library and standard C++ threading primitives. ```cpp #include "rocket.hpp" #include #include #include #include #include class WorkerThread { public: void start() { shouldRun = true; thread = std::thread(&WorkerThread::run, this); } void shutdown() { shouldRun = false; thread.join(); } void pushTask(const std::string& task) { std::lock_guard guard{ mutex }; tasks.push_front(task); } private: void run() { while (shouldRun) { std::forward_list workItems; { std::lock_guard guard{ mutex }; tasks.swap(workItems); } for (auto& task : workItems) { taskCompleted(task); // Emit signal from worker thread } std::this_thread::sleep_for(std::chrono::milliseconds(50)); } } public: rocket::thread_safe_signal taskCompleted; private: std::thread thread; bool shouldRun = false; std::mutex mutex; std::forward_list tasks; }; class MainThread { public: void initialize() { worker.start(); // Connect with queued_connection - slot runs on MainThread worker.taskCompleted.connect<&MainThread::onTaskCompleted>( this, rocket::queued_connection); } void shutdown() { worker.shutdown(); } void processEvents() { // Dispatch queued slot calls on this thread rocket::dispatch_queued_calls(); // Process results safely without locks // onTaskCompleted was called on this thread } private: void onTaskCompleted(const std::string& task) { // This runs on MainThread, not WorkerThread std::cout << "Task completed: " << task << std::endl; } WorkerThread worker; }; int main() { MainThread main; main.initialize(); // Simulate event loop for (int i = 0; i < 10; ++i) { main.processEvents(); std::this_thread::sleep_for(std::chrono::milliseconds(100)); } main.shutdown(); } ``` -------------------------------- ### Self-Disconnecting Slots with current_connection in C++ Source: https://context7.com/tripleslash/rocket/llms.txt Demonstrates how a slot can disconnect itself from a signal during its execution using `rocket::current_connection()`. This is useful for slots that should only be invoked once or need to be dynamically removed based on certain conditions. The example shows a slot that prints a message and then disconnects, so subsequent signal calls do not trigger it. ```cpp #include "rocket.hpp" #include int main() { rocket::signal signal; // Slot that disconnects itself after first invocation signal.connect([] { std::cout << "Slot called. Now disconnecting..." << std::endl; // current_connection() returns the active connection (thread-local) rocket::current_connection().disconnect(); }); signal(); // First call - executes and disconnects signal(); // No output - slot already disconnected signal(); // No output - slot already disconnected // Output: // Slot called. Now disconnecting... } ``` -------------------------------- ### Demonstrate Connection Blocking with Rocket C++ Signal/Slot Library Source: https://context7.com/tripleslash/rocket/llms.txt Shows how to temporarily block signal connections without disconnecting using scoped_connection_blocker and manual block/unblock methods. Demonstrates fine-grained control over event flow with automatic restoration when blockers go out of scope. Includes tracking of handler invocation counts to verify blocking behavior. ```cpp #include "rocket.hpp" #include int main() { rocket::signal signal; int callCount = 0; auto conn = signal.connect([&callCount](int value) { callCount++; std::cout << "Handler called with value: " << value << std::endl; }); signal(1); // Handler called std::cout << "Call count: " << callCount << std::endl; // Output: // Handler called with value: 1 // Call count: 1 { // Block connection temporarily rocket::scoped_connection_blocker blocker{ conn }; signal(2); // Handler NOT called (blocked) signal(3); // Handler NOT called (blocked) std::cout << "Call count during blocking: " << callCount << std::endl; // Output: // Call count during blocking: 1 } // blocker destroyed, connection unblocked signal(4); // Handler called again std::cout << "Call count after unblock: " << callCount << std::endl; // Output: // Handler called with value: 4 // Call count after unblock: 2 // Manual blocking/unblocking conn.block(); signal(5); // Not called conn.unblock(); signal(6); // Called // Output: // Handler called with value: 6 } ``` -------------------------------- ### ModelFileLoaderThread: Asynchronous Model Loading with Signals Source: https://github.com/tripleslash/rocket/blob/master/README.md This C++ class simulates a thread that loads model files from disk and performs preprocessing. It uses `rocket::thread_safe_signal` to emit signals `modelLoaded` and `modelLoadFailed` when operations complete. It manages a queue of loading requests to handle multiple files asynchronously. Dependencies include ``, ``, ``, and Rocket's signal types. ```cpp class ModelFileLoaderThread { public: void start() { shouldRun = true; thread = std::thread(&ModelFileLoaderThread::run, this); } void shutdown() { shouldRun = false; thread.join(); } void pushLoadRequest(const std::string& fileName) { std::scoped_lock guard{ mutex }; loadRequests.push_front(fileName); } private: void run() { while (shouldRun) { std::forward_list requests; { std::scoped_lock guard{ mutex }; loadRequests.swap(requests); } for (auto& fileName : requests) { ModelFilePtr modelFile = new ModelFile(fileName); if (modelFile->loadModel()) { modelLoaded(modelFile); } else { modelLoadFailed(fileName); } } std::this_thread::sleep_for(std::chrono::milliseconds(50)); } } public: rocket::thread_safe_signal modelLoaded; rocket::thread_safe_signal modelLoadFailed; private: std::thread thread; volatile bool shouldRun = false; std::mutex mutex; std::forward_list loadRequests; }; ``` -------------------------------- ### Declare and Connect Basic Signals (C++) Source: https://context7.com/tripleslash/rocket/llms.txt Demonstrates the declaration of thread-unsafe and thread-safe signals and how to connect handler functions using both the `connect()` method and the `+=` operator. It shows how to emit a signal and the expected output from connected handlers. ```cpp #include "rocket.hpp" #include int main() { // Thread-unsafe signal (faster, no locking overhead) rocket::signal thread_unsafe_signal; // Thread-safe signal (supports cross-thread invocation) rocket::thread_safe_signal thread_safe_signal; // Connect handlers using connect() method thread_unsafe_signal.connect([]() { std::cout << "First handler called!" << std::endl; }); // Connect handlers using operator+= shorthand thread_unsafe_signal += []() { std::cout << "Second handler called!" << std::endl; }; // Invoke the signal (calls all connected handlers) thread_unsafe_signal(); // Output: // First handler called! // Second handler called! } ``` -------------------------------- ### RenderThread: Processing Queued Model Load Signals Source: https://github.com/tripleslash/rocket/blob/master/README.md This C++ class represents a rendering thread that needs to be notified when models are loaded or loading fails. It connects to `ModelFileLoaderThread`'s signals using `rocket::queued_connection`, ensuring that signal handlers are executed in the `RenderThread`'s context when `rocket::dispatch_queued_calls()` is invoked. It manages a list of renderable objects. ```cpp class RenderThread { public: void initialize() { modelLoaderThread.start(); // Connect to the thread using queued_connection flag modelLoaderThread.modelLoaded.connect<&RenderThread::onModelLoaded>(this, rocket::queued_connection); modelLoaderThread.modelLoadFailed.connect<&RenderThread::onModelLoadFailed>(this, rocket::queued_connection); } void shutdown() { modelLoaderThread.shutdown(); } void render() { rocket::dispatch_queued_calls(); //<-- This call is required so rocket can call the queued slots from this thread for (IRenderablePtr& renderable : renderables) { renderable->render(); } } private: // These slots are actually executed from inside the `rocket::dispatch_queued_calls` method void onModelLoaded(ModelFilePtr const& modelFile) { // No lock needed, because onModelLoaded is called on render thread! renderables.push_back(new ModelRenderer(modelFile)); } void onModelLoadFailed(std::string const& fileName) { // Show log message } private: std::list renderables; ModelFileLoaderThread modelLoaderThread; }; ``` -------------------------------- ### Abort Signal Emission from a Slot (C++) Source: https://github.com/tripleslash/rocket/blob/master/README.md Demonstrates how a slot can preemptively abort the emission of a signal using `rocket::abort_emission()`. This stops further slots from being invoked, useful when the first slot finds the desired result. ```cpp #include int main() { rocket::signal signal; signal.connect([] { std::cout << "First slot called. Aborting emission of other slots." << std::endl; rocket::abort_emission(); // Notice that this doesn't disconnect the other slots. It just breaks out of the // signal emitting loop. }); signal.connect([] { std::cout << "Second slot called. Should never happen." << std::endl; }); signal(); } ``` -------------------------------- ### Custom Value Collectors for Signal Return Values (C++) Source: https://github.com/tripleslash/rocket/blob/master/README.md Illustrates using a custom value collector, `rocket::range`, to gather all return values from connected slots. It also shows how to override the collector at invocation time using `invoke` with collectors like `rocket::first` and `rocket::last`. ```cpp #include #include #include int main() { // Because we set `rocket::range` as the value collector for this signal // calling operator() now returns the return values of all connected slots. rocket::signal> signal; // Lets connect a couple more functions to our signal and print all the // return values. signal.connect(std::sinf); signal.connect(std::cosf); std::cout << std::fixed << std::setprecision(2); for (auto result : signal(3.14159)) { std::cout << result << std::endl; } // We can also override the return value collector at invocation time std::cout << "First return value: " << signal.invoke>(3.14159); std::cout << std::endl; std::cout << "Last return value: " << signal.invoke>(3.14159); } ``` -------------------------------- ### Collecting Return Values with Value Collectors in C++ Source: https://context7.com/tripleslash/rocket/llms.txt Illustrates collecting return values from multiple signal slots using various collector policies provided by the Rocket library. It shows the default collector (last return value), `rocket::range` for all values, and how to override collectors at invocation time using `invoke` with policies like `rocket::first`, `rocket::last`, `rocket::minimum`, and `rocket::maximum`. This feature is useful for aggregating results from distributed computations or observers. ```cpp #include "rocket.hpp" #include #include #include int main() { // Default collector returns optional with last slot's return value rocket::signal signal1; signal1.connect(std::sqrtf); std::cout << "Single value: " << *signal1(16) << std::endl; // Output: Single value: 4 // range collector returns all slot return values in a list rocket::signal> signal2; signal2.connect(std::sinf); signal2.connect(std::cosf); std::cout << std::fixed << std::setprecision(2); std::cout << "Range results:" << std::endl; for (auto result : signal2(3.14159)) { std::cout << " " << result << std::endl; } // Output: // Range results: // 0.00 // -1.00 // Override collector at invocation time std::cout << "First: " << signal2.invoke>(3.14159) << std::endl; std::cout << "Last: " << signal2.invoke>(3.14159) << std::endl; // Output: // First: 0.00 // Last: -1.00 // Use minimum/maximum collectors rocket::signal signal3; signal3.connect([](int x) { return x * 3; }); signal3.connect([](int x) { return x * 1; }); signal3.connect([](int x) { return x * 2; }); std::cout << "Minimum: " << signal3.invoke>(5) << std::endl; std::cout << "Maximum: " << signal3.invoke>(5) << std::endl; // Output: // Minimum: 5 // Maximum: 15 } ``` -------------------------------- ### Manual Lifetime Management with scoped_connection in C++ Source: https://context7.com/tripleslash/rocket/llms.txt Demonstrates how to manually manage the lifetime of signal connections using `rocket::scoped_connection`. This ensures deterministic disconnection when the `scoped_connection` object goes out of scope, preventing dangling pointers or unexpected slot calls. It's useful when explicit control over connection duration is required. ```cpp #include "rocket.hpp" #include #include #include class ILogger { public: virtual void logMessage(const std::string& message) = 0; }; class ConsoleLogger : public ILogger { public: void logMessage(const std::string& message) override { std::cout << "New log message: " << message << std::endl; } }; class App { public: void run() { onSuccess("Task completed!"); } rocket::signal onSuccess; }; int main() { std::unique_ptr app = std::make_unique(); { std::unique_ptr logger = std::make_unique(); // scoped_connection manages connection lifetime rocket::scoped_connection connection = app->onSuccess.connect<&ILogger::logMessage>(logger.get()); app->run(); // Output: New log message: Task completed! } // connection destroyed, slot disconnected app->run(); // Safe - no output, slot disconnected } ``` -------------------------------- ### Automatic Slot Disconnection with rocket::trackable (C++) Source: https://context7.com/tripleslash/rocket/llms.txt Shows how to use `rocket::trackable` as a base class for observer objects to achieve automatic disconnection of slots when the observer is destroyed. This prevents dangling connections and potential crashes, especially when dealing with dynamically allocated objects. ```cpp #include "rocket.hpp" #include #include #include class ILogger : public rocket::trackable { public: virtual void logMessage(const std::string& message) = 0; }; class ConsoleLogger : public ILogger { public: void logMessage(const std::string& message) override { std::cout << "New log message: " << message << std::endl; } }; class App { public: void run() { if (work()) { onSuccess("I finished my work!"); } } bool work() { return true; } rocket::signal onSuccess; }; int main() { std::unique_ptr app = std::make_unique(); { std::unique_ptr logger = std::make_unique(); // Connect to signal - will auto-disconnect when logger is destroyed app->onSuccess.connect<&ILogger::logMessage>(logger.get()); app->run(); // Output: New log message: I finished my work! } // logger destroyed here, slot automatically disconnected app->run(); // Safe - no crash, logger slot already disconnected } ``` -------------------------------- ### Schedule Recurring Timer with C++ set_interval Source: https://github.com/tripleslash/rocket/blob/master/README.md This C++ code snippet demonstrates how to use `rocket::set_interval` to schedule a member function (`onClearRenderablesTimerExpired`) to be called periodically every 5000 milliseconds. It's part of a `RenderThread` class and is managed within a `rocket::scoped_connection_container`. The timer is set up during thread initialization. ```cpp class RenderThread { public: void initialize() { modelLoaderThread.start(); connections += { // Register a timer that gets called every 5000 ms rocket::set_interval<&RenderThread::onClearRenderablesTimerExpired>(this, 5000), // Connect to the thread using queued_connection flag modelLoaderThread.modelLoaded.connect<&RenderThread::onModelLoaded>(this, rocket::queued_connection), modelLoaderThread.modelLoadFailed.connect<&RenderThread::onModelLoadFailed>(this, rocket::queued_connection) }; } void shutdown() { modelLoaderThread.shutdown(); } void render() { rocket::dispatch_queued_calls(); //<-- This call is required so rocket can call the queued slots from this thread for (IRenderablePtr& renderable : renderables) { // Will be rendered for at most 5 seconds because `onClearRenderablesTimerExpired` periodically clears the renderables renderable->render(); } } private: // These slots are actually executed from inside the `rocket::dispatch_queued_calls` method void onModelLoaded(ModelFilePtr const& modelFile) { // No lock needed, because onModelLoaded is called on render thread! renderables.push_back(new ModelRenderer(modelFile)); } void onModelLoadFailed(std::string const& fileName) { // Show log message } void onClearRenderablesTimerExpired() { // Called every 5000 ms from inside the `rocket::dispatch_queued_calls` method renderables.clear(); } private: rocket::scoped_connection_container connections; std::list renderables; ModelFileLoaderThread modelLoaderThread; }; ``` -------------------------------- ### Disconnect Slot from Within Itself (C++) Source: https://github.com/tripleslash/rocket/blob/master/README.md Shows how a slot can access the current connection object using `rocket::current_connection()` and disconnect itself from the signal. This is useful for creating one-time callback mechanisms. ```cpp #include int main() { rocket::signal signal; signal.connect([] { std::cout << "Slot called. Now disconnecting..." << std::endl; // `current_connection` is stored in thread-local-storage. rocket::current_connection().disconnect(); }); signal(); signal(); signal(); } ``` -------------------------------- ### Aborting Signal Emission from Slots in C++ Source: https://context7.com/tripleslash/rocket/llms.txt Shows how to preemptively stop a signal's emission process from within a connected slot using `rocket::abort_emission()`. When called, this function halts the invocation of any subsequent slots connected to the same signal for the current emission. This is valuable for implementing early exit conditions or error handling where further processing is unnecessary. ```cpp #include "rocket.hpp" #include int main() { rocket::signal signal; signal.connect([] { std::cout << "First slot called. Aborting emission." << std::endl; // Abort emission - stops calling remaining slots rocket::abort_emission(); }); signal.connect([] { std::cout << "Second slot - should never execute." << std::endl; }); signal.connect([] { std::cout << "Third slot - should never execute." << std::endl; }); signal(); // Output: // First slot called. Aborting emission. // Note: Slots remain connected, they're just not called for this emission // Next signal() call will start from the first slot again } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.