[garnet] Reland "Remove MakeCopyable dependencies"

This reverts commit 077444b5ce477a01a0d268f82e0a0cb123b2c20b.

Reason for revert: relanding (revert revert) after resolving build error with merge of https://fuchsia-review.googlesource.com/c/peridot/+/245012

Original change's description:
> Revert "[garnet] Remove MakeCopyable dependencies"
>
> This reverts commit e5dee7e7d47a9d28092ad00c45f50192af4b18a5.
>
> Reason for revert: this CL breaks peridot (fxl::Closure no longer has
> the same semantics), which prevents garnet from rolling.
>
> Original change's description:
> > [garnet] Remove MakeCopyable dependencies
> >
> > [Confirmed this compiles under both x64 and arm64]
> >
> > This change replaces many std::function references with
> > the new fit::function, allowing functions to be passed with
> > move-only semantics, which is more efficient than "copy",
> > and safer than pass-by-reference. It also allows lambdas to
> > include move-only objects without requiring the MakeCopyable
> > workaround.
> >
> > Note that this covers all of garnet (except for eventually
> > removing MakeCopyable itself). Changes are forthcoming in
> > topaz and peridot.
> >
> > Issue: ZX-3289
> > Test: No behavior change
> > Change-Id: I3fbc402e37652f0dac807441b00ba935cf403a93
>
> TBR=abarth@google.com,richkadel@google.com
>
> Change-Id: Idce39513309f4dd84d2abfbb63891b74030ee43f
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Issue: ZX-3289

TBR=kulakowski@google.com,vardhan@google.com,abarth@google.com,richkadel@google.com

Change-Id: Ia310a86b059ee1789ce6950ab19e7344b378c34e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Issue: ZX-3289
diff --git a/bin/appmgr/realm.cc b/bin/appmgr/realm.cc
index b284dfa..2d66598 100644
--- a/bin/appmgr/realm.cc
+++ b/bin/appmgr/realm.cc
@@ -34,7 +34,6 @@
 #include "lib/fsl/vmo/strings.h"
 #include "lib/fxl/files/directory.h"
 #include "lib/fxl/files/file.h"
-#include "lib/fxl/functional/make_copyable.h"
 #include "lib/fxl/strings/concatenate.h"
 #include "lib/fxl/strings/string_printf.h"
 #include "lib/fxl/strings/substitute.h"
@@ -408,37 +407,35 @@
     return;
   }
 
-  loader_->LoadUrl(
-      canon_url,
-      fxl::MakeCopyable([this, callback = std::move(callback)](
-                            fuchsia::sys::PackagePtr package) mutable {
-        zx::vmo binary;
-        fidl::InterfaceHandle<fuchsia::ldsvc::Loader> loader;
-        if (!package) {
-          callback(ZX_ERR_NOT_FOUND, std::move(binary), std::move(loader));
-          return;
-        }
-        if (!package->data) {
-          callback(ZX_ERR_NOT_FOUND, std::move(binary), std::move(loader));
-          return;
-        }
-        binary.swap(package->data->vmo);
+  loader_->LoadUrl(canon_url, [this, callback = std::move(callback)](
+                                  fuchsia::sys::PackagePtr package) mutable {
+    zx::vmo binary;
+    fidl::InterfaceHandle<fuchsia::ldsvc::Loader> loader;
+    if (!package) {
+      callback(ZX_ERR_NOT_FOUND, std::move(binary), std::move(loader));
+      return;
+    }
+    if (!package->data) {
+      callback(ZX_ERR_NOT_FOUND, std::move(binary), std::move(loader));
+      return;
+    }
+    binary.swap(package->data->vmo);
 
-        if (!package->directory) {
-          callback(ZX_ERR_NOT_FOUND, std::move(binary), std::move(loader));
-          return;
-        }
-        fxl::UniqueFD dirfd =
-            fsl::OpenChannelAsFileDescriptor(std::move(package->directory));
+    if (!package->directory) {
+      callback(ZX_ERR_NOT_FOUND, std::move(binary), std::move(loader));
+      return;
+    }
+    fxl::UniqueFD dirfd =
+        fsl::OpenChannelAsFileDescriptor(std::move(package->directory));
 
-        zx::channel chan;
-        if (DynamicLibraryLoader::Start(std::move(dirfd), &chan) != ZX_OK) {
-          callback(ZX_ERR_INTERNAL, std::move(binary), std::move(loader));
-          return;
-        }
-        loader.set_channel(std::move(chan));
-        callback(ZX_OK, std::move(binary), std::move(loader));
-      }));
+    zx::channel chan;
+    if (DynamicLibraryLoader::Start(std::move(dirfd), &chan) != ZX_OK) {
+      callback(ZX_ERR_INTERNAL, std::move(binary), std::move(loader));
+      return;
+    }
+    loader.set_channel(std::move(chan));
+    callback(ZX_OK, std::move(binary), std::move(loader));
+  });
 }
 
 void Realm::CreateComponent(
@@ -484,21 +481,19 @@
 
     // launch_info is moved before LoadUrl() gets at its first argument.
     fidl::StringPtr url = launch_info.url;
-    loader_->LoadUrl(
-        url,
-        fxl::MakeCopyable([this, launch_info = std::move(launch_info),
+    loader_->LoadUrl(url, [this, launch_info = std::move(launch_info),
                            component_request = std::move(component_request),
                            callback = std::move(callback)](
                               fuchsia::sys::PackagePtr package) mutable {
-          if (package && package->directory) {
-            CreateComponentFromPackage(
-                std::move(package), std::move(launch_info),
-                std::move(component_request), std::move(callback));
-          } else {
-            component_request.SetReturnValues(
-                kComponentCreationFailed, TerminationReason::PACKAGE_NOT_FOUND);
-          }
-        }));
+      if (package && package->directory) {
+        CreateComponentFromPackage(std::move(package), std::move(launch_info),
+                                   std::move(component_request),
+                                   std::move(callback));
+      } else {
+        component_request.SetReturnValues(kComponentCreationFailed,
+                                          TerminationReason::PACKAGE_NOT_FOUND);
+      }
+    });
   } else {
     // Component from scheme that maps to a runner.
     CreateComponentWithRunnerForScheme(launcher_type, std::move(launch_info),
diff --git a/bin/appmgr/runner_holder.cc b/bin/appmgr/runner_holder.cc
index d762b5f..4a7c417 100644
--- a/bin/appmgr/runner_holder.cc
+++ b/bin/appmgr/runner_holder.cc
@@ -7,9 +7,10 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
-
 #include <utility>
 
+#include <lib/fit/function.h>
+
 #include "garnet/bin/appmgr/component_controller_impl.h"
 #include "garnet/bin/appmgr/realm.h"
 #include "garnet/bin/appmgr/util.h"
@@ -22,11 +23,11 @@
 RunnerHolder::RunnerHolder(Services services,
                            fuchsia::sys::ComponentControllerPtr controller,
                            fuchsia::sys::LaunchInfo launch_info, Realm* realm,
-                           std::function<void()> error_handler)
+                           fit::function<void()> error_handler)
     : services_(std::move(services)),
       controller_(std::move(controller)),
       impl_object_(nullptr),
-      error_handler_(error_handler),
+      error_handler_(std::move(error_handler)),
       component_id_counter_(0) {
   realm->CreateComponent(std::move(launch_info), controller_.NewRequest(),
                          [this](ComponentControllerImpl* component) {
diff --git a/bin/appmgr/runner_holder.h b/bin/appmgr/runner_holder.h
index c8cd556..9441fb3 100644
--- a/bin/appmgr/runner_holder.h
+++ b/bin/appmgr/runner_holder.h
@@ -5,6 +5,7 @@
 #ifndef GARNET_BIN_APPMGR_RUNNER_HOLDER_H_
 #define GARNET_BIN_APPMGR_RUNNER_HOLDER_H_
 
+#include <lib/fit/function.h>
 #include <lib/zx/vmo.h>
 
 #include <fuchsia/sys/cpp/fidl.h>
@@ -25,7 +26,7 @@
   RunnerHolder(Services services,
                fuchsia::sys::ComponentControllerPtr controller,
                fuchsia::sys::LaunchInfo launch_info, Realm* realm,
-               std::function<void()> error_handler = nullptr);
+               fit::function<void()> error_handler = nullptr);
   ~RunnerHolder();
 
   void StartComponent(
@@ -45,7 +46,7 @@
   fuchsia::sys::ComponentControllerPtr controller_;
   fuchsia::sys::RunnerPtr runner_;
   ComponentControllerImpl* impl_object_;
-  std::function<void()> error_handler_;
+  fit::function<void()> error_handler_;
   std::unordered_map<ComponentBridge*, std::unique_ptr<ComponentBridge>>
       components_;
   uint64_t component_id_counter_;
diff --git a/bin/cobalt/app/cobalt_controller_impl.cc b/bin/cobalt/app/cobalt_controller_impl.cc
index 48b7c6d..0d35fa7 100644
--- a/bin/cobalt/app/cobalt_controller_impl.cc
+++ b/bin/cobalt/app/cobalt_controller_impl.cc
@@ -8,8 +8,6 @@
 #include <mutex>
 #include <vector>
 
-#include "lib/fxl/functional/make_copyable.h"
-
 namespace cobalt {
 
 using encoder::ShippingManager;
diff --git a/bin/guest/manager/environment_controller_impl.cc b/bin/guest/manager/environment_controller_impl.cc
index aad49e8..966b2f0 100644
--- a/bin/guest/manager/environment_controller_impl.cc
+++ b/bin/guest/manager/environment_controller_impl.cc
@@ -4,6 +4,7 @@
 
 #include "garnet/bin/guest/manager/environment_controller_impl.h"
 
+#include <lib/fit/function.h>
 #include <lib/fxl/logging.h>
 
 #include "garnet/bin/guest/manager/guest_services.h"
@@ -28,7 +29,7 @@
 }
 
 void EnvironmentControllerImpl::set_unbound_handler(
-    std::function<void()> handler) {
+    fit::function<void()> handler) {
   bindings_.set_empty_set_handler(std::move(handler));
 }
 
@@ -48,7 +49,8 @@
   info.arguments = std::move(launch_info.args);
   info.directory_request = services.NewRequest();
   info.flat_namespace = std::move(launch_info.flat_namespace);
-  std::string label = launch_info.label ? launch_info.label.get() : launch_info.url;
+  std::string label =
+      launch_info.label ? launch_info.label.get() : launch_info.url;
   auto guest_services = std::make_unique<GuestServices>(std::move(launch_info));
   info.additional_services = guest_services->ServeDirectory();
   launcher_->CreateComponent(std::move(info),
diff --git a/bin/guest/manager/environment_controller_impl.h b/bin/guest/manager/environment_controller_impl.h
index ebac225..f96174c 100644
--- a/bin/guest/manager/environment_controller_impl.h
+++ b/bin/guest/manager/environment_controller_impl.h
@@ -11,6 +11,7 @@
 #include <fuchsia/sys/cpp/fidl.h>
 #include <lib/component/cpp/startup_context.h>
 #include <lib/fidl/cpp/binding_set.h>
+#include <lib/fit/function.h>
 
 #include "garnet/bin/guest/manager/guest_component.h"
 #include "garnet/bin/guest/manager/host_vsock_endpoint.h"
@@ -34,7 +35,7 @@
   const std::string& label() const { return label_; }
   // Invoked once all bindings have been removed and this environment has been
   // orphaned.
-  void set_unbound_handler(std::function<void()> handler);
+  void set_unbound_handler(fit::function<void()> handler);
 
   void AddBinding(fidl::InterfaceRequest<EnvironmentController> request);
   fidl::VectorPtr<fuchsia::guest::InstanceInfo> ListGuests();
diff --git a/bin/http/http_url_loader_impl.cc b/bin/http/http_url_loader_impl.cc
index 9338720..5f96235 100644
--- a/bin/http/http_url_loader_impl.cc
+++ b/bin/http/http_url_loader_impl.cc
@@ -13,7 +13,6 @@
 #include "garnet/bin/http/http_adapters.h"
 #include "garnet/bin/http/http_client.h"
 #include "garnet/bin/http/http_errors.h"
-#include "lib/fxl/functional/make_copyable.h"
 #include "lib/fxl/logging.h"
 #include "lib/url/gurl.h"
 
@@ -32,11 +31,11 @@
 
 void URLLoaderImpl::Start(oldhttp::URLRequest request, Callback callback) {
   callback_ = std::move(callback);
-  coordinator_->RequestNetworkSlot(fxl::MakeCopyable(
+  coordinator_->RequestNetworkSlot(
       [this, request = std::move(request)](fit::closure on_inactive) mutable {
         StartInternal(std::move(request));
         on_inactive();
-      }));
+      });
 }
 
 void URLLoaderImpl::FollowRedirect(Callback callback) {
@@ -61,7 +60,8 @@
   SendResponse(std::move(response));
 }
 
-void URLLoaderImpl::FollowRedirectInternal() { /* TODO(toshik) */ }
+void URLLoaderImpl::FollowRedirectInternal() { /* TODO(toshik) */
+}
 
 void URLLoaderImpl::SendResponse(oldhttp::URLResponse response) {
   Callback callback;
diff --git a/bin/mdns/service/mdns_service_impl.cc b/bin/mdns/service/mdns_service_impl.cc
index 3fb98cb..8194ab3 100644
--- a/bin/mdns/service/mdns_service_impl.cc
+++ b/bin/mdns/service/mdns_service_impl.cc
@@ -11,7 +11,6 @@
 #include "garnet/bin/mdns/service/mdns_names.h"
 #include "lib/component/cpp/startup_context.h"
 #include "lib/fsl/types/type_converters.h"
-#include "lib/fxl/functional/make_copyable.h"
 #include "lib/fxl/logging.h"
 #include "lib/fxl/type_converter.h"
 
@@ -54,8 +53,9 @@
 
   if (host_name == kUnsetHostName) {
     // Host name not set. Try again soon.
-    async::PostDelayedTask(async_get_default_dispatcher(),
-                           [this]() { Start(); }, kReadyPollingInterval);
+    async::PostDelayedTask(
+        async_get_default_dispatcher(), [this]() { Start(); },
+        kReadyPollingInterval);
     return;
   }
 
@@ -65,15 +65,14 @@
 
   // Publish this device as "_fuchsia._udp.".
   // TODO(dalesat): Make this a config item or delegate to another party.
-  PublishServiceInstance(kPublishAs, host_name, kPublishPort,
-                         fidl::VectorPtr<std::string>(),
-                         [this](fuchsia::mdns::MdnsResult result) {
-                           if (result != fuchsia::mdns::MdnsResult::OK) {
-                             FXL_LOG(ERROR) << "Failed to publish as "
-                                            << kPublishAs << ", result "
-                                            << static_cast<uint32_t>(result);
-                           }
-                         });
+  PublishServiceInstance(
+      kPublishAs, host_name, kPublishPort, fidl::VectorPtr<std::string>(),
+      [this](fuchsia::mdns::MdnsResult result) {
+        if (result != fuchsia::mdns::MdnsResult::OK) {
+          FXL_LOG(ERROR) << "Failed to publish as " << kPublishAs << ", result "
+                         << static_cast<uint32_t>(result);
+        }
+      });
 }
 
 void MdnsServiceImpl::ResolveHostName(std::string host_name,
@@ -352,10 +351,10 @@
   FXL_DCHECK(responder_);
   responder_->GetPublication(
       query, subtype,
-      fxl::MakeCopyable([callback = std::move(callback)](
-                            fuchsia::mdns::MdnsPublicationPtr publication_ptr) {
+      [callback = std::move(callback)](
+          fuchsia::mdns::MdnsPublicationPtr publication_ptr) {
         callback(MdnsFidlUtil::Convert(publication_ptr));
-      }));
+      });
 }
 
 }  // namespace mdns
diff --git a/bin/media/codecs/sw/omx/codec_runner_sw_omx/local_codec_factory.h b/bin/media/codecs/sw/omx/codec_runner_sw_omx/local_codec_factory.h
index 1576dca..ce2b6a7 100644
--- a/bin/media/codecs/sw/omx/codec_runner_sw_omx/local_codec_factory.h
+++ b/bin/media/codecs/sw/omx/codec_runner_sw_omx/local_codec_factory.h
@@ -10,6 +10,7 @@
 #include <functional>
 
 #include <fuchsia/mediacodec/cpp/fidl.h>
+#include <lib/fit/function.h>
 
 #include "lib/fidl/cpp/binding.h"
 
@@ -45,7 +46,7 @@
 
 class LocalCodecFactory : public fuchsia::mediacodec::CodecFactory {
  public:
-  using BindAudioDecoderCallback = std::function<void(
+  using BindAudioDecoderCallback = fit::function<void(
       fidl::InterfaceRequest<fuchsia::mediacodec::Codec>,
       fuchsia::mediacodec::CreateDecoder_Params audio_params)>;
 
@@ -92,7 +93,7 @@
     fuchsia::mediacodec::CodecType codec_type;
     std::string_view mime_type;
     std::string_view lib_filename;
-    std::function<std::unique_ptr<codec_runner::CodecRunner>(
+    fit::function<std::unique_ptr<codec_runner::CodecRunner>(
         async_dispatcher_t* dispatcher, thrd_t fidl_thread,
         const CodecStrategy& codec_strategy)>
         create_runner;
diff --git a/bin/mediaplayer/fidl/fidl_audio_renderer.cc b/bin/mediaplayer/fidl/fidl_audio_renderer.cc
index 22a0c50..b564d5f 100644
--- a/bin/mediaplayer/fidl/fidl_audio_renderer.cc
+++ b/bin/mediaplayer/fidl/fidl_audio_renderer.cc
@@ -8,7 +8,6 @@
 
 #include "garnet/bin/mediaplayer/fidl/fidl_type_conversions.h"
 #include "garnet/bin/mediaplayer/graph/formatting.h"
-#include "lib/fxl/functional/make_copyable.h"
 #include "lib/fxl/logging.h"
 #include "lib/media/timeline/timeline.h"
 #include "lib/media/timeline/timeline_rate.h"
@@ -129,12 +128,11 @@
   SetEndOfStreamPts(fuchsia::media::NO_TIMESTAMP);
   input_packet_request_outstanding_ = false;
 
-  audio_renderer_->DiscardAllPackets(
-      fxl::MakeCopyable([this, callback = std::move(callback)]() {
-        last_supplied_pts_ns_ = 0;
-        last_departed_pts_ns_ = fuchsia::media::NO_TIMESTAMP;
-        callback();
-      }));
+  audio_renderer_->DiscardAllPackets([this, callback = std::move(callback)]() {
+    last_supplied_pts_ns_ = 0;
+    last_departed_pts_ns_ = fuchsia::media::NO_TIMESTAMP;
+    callback();
+  });
 }
 
 void FidlAudioRenderer::PutInputPacket(PacketPtr packet, size_t input_index) {
diff --git a/bin/netconnector/listener.cc b/bin/netconnector/listener.cc
index b5f6104..961db03 100644
--- a/bin/netconnector/listener.cc
+++ b/bin/netconnector/listener.cc
@@ -12,7 +12,6 @@
 
 #include "garnet/lib/inet/ip_port.h"
 #include "lib/fxl/files/unique_fd.h"
-#include "lib/fxl/functional/make_copyable.h"
 #include "lib/fxl/logging.h"
 
 namespace netconnector {
@@ -87,11 +86,10 @@
       break;
     }
 
-    async::PostTask(
-        dispatcher_,
-        fxl::MakeCopyable([this, fd = std::move(connection_fd)]() mutable {
-          new_connection_callback_(std::move(fd));
-        }));
+    async::PostTask(dispatcher_,
+                    [this, fd = std::move(connection_fd)]() mutable {
+                      new_connection_callback_(std::move(fd));
+                    });
   }
 }
 
diff --git a/bin/netconnector/responding_service_host.cc b/bin/netconnector/responding_service_host.cc
index d319a26..67964b9 100644
--- a/bin/netconnector/responding_service_host.cc
+++ b/bin/netconnector/responding_service_host.cc
@@ -6,7 +6,6 @@
 
 #include "lib/component/cpp/connect.h"
 #include "lib/fidl/cpp/clone.h"
-#include "lib/fxl/functional/make_copyable.h"
 #include "lib/fxl/logging.h"
 
 namespace netconnector {
@@ -22,9 +21,8 @@
 void RespondingServiceHost::RegisterSingleton(
     const std::string& service_name, fuchsia::sys::LaunchInfoPtr launch_info) {
   service_namespace_.AddServiceForName(
-      fxl::MakeCopyable([this, service_name,
-                         launch_info = std::move(launch_info)](
-                            zx::channel client_handle) mutable {
+      [this, service_name, launch_info = std::move(launch_info)](
+          zx::channel client_handle) mutable {
         FXL_VLOG(2) << "Handling request for service " << service_name;
 
         auto iter = service_providers_by_name_.find(service_name);
@@ -61,7 +59,7 @@
         }
 
         iter->second.ConnectToService(service_name, std::move(client_handle));
-      }),
+      },
       service_name);
 }
 
diff --git a/bin/sysmgr/delegating_loader.cc b/bin/sysmgr/delegating_loader.cc
index 62950aa..599c296 100644
--- a/bin/sysmgr/delegating_loader.cc
+++ b/bin/sysmgr/delegating_loader.cc
@@ -77,9 +77,9 @@
   }
 
   if (package_updating_fallback_) {
-    package_updating_fallback_->LoadUrl(url, callback);
+    package_updating_fallback_->LoadUrl(url, std::move(callback));
   } else {
-    parent_fallback_->LoadUrl(url, callback);
+    parent_fallback_->LoadUrl(url, std::move(callback));
   }
 }
 
diff --git a/bin/sysmgr/package_updating_loader.cc b/bin/sysmgr/package_updating_loader.cc
index f6784f6..9aff206 100644
--- a/bin/sysmgr/package_updating_loader.cc
+++ b/bin/sysmgr/package_updating_loader.cc
@@ -38,8 +38,7 @@
 
 PackageUpdatingLoader::~PackageUpdatingLoader() = default;
 
-void PackageUpdatingLoader::LoadUrl(std::string url,
-                                    LoadUrlCallback callback) {
+void PackageUpdatingLoader::LoadUrl(std::string url, LoadUrlCallback callback) {
   EnsureConnectedToResolver();
 
   // The updating loader can only update fuchsia-pkg URLs.
@@ -52,7 +51,7 @@
                                component::GetPathFromURL(url));
   }
   if (!parsed) {
-    PackageLoader::LoadUrl(url, callback);
+    PackageLoader::LoadUrl(url, std::move(callback));
     return;
   }
 
@@ -62,21 +61,21 @@
   // here.
   if (std::find(update_dependency_urls_.begin(), update_dependency_urls_.end(),
                 url) != std::end(update_dependency_urls_)) {
-    PackageLoader::LoadUrl(url, callback);
+    PackageLoader::LoadUrl(url, std::move(callback));
     return;
   }
 
   fuchsia::io::DirectoryPtr dir;
   auto dir_request = dir.NewRequest(dispatcher_);
   auto done_cb = [this, url, dir = std::move(dir),
-                  callback](zx_status_t status) mutable {
+                  callback = std::move(callback)](zx_status_t status) mutable {
     // TODO: only fail soft on NOT_FOUND?
     if (status != ZX_OK) {
       FXL_VLOG(1) << "Package update failed with "
                   << zx_status_get_string(status)
                   << ". Loading package without update: " << url;
     }
-    PackageLoader::LoadUrl(url, callback);
+    PackageLoader::LoadUrl(url, std::move(callback));
   };
 
   fuchsia::pkg::UpdatePolicy update_policy;
diff --git a/bin/tts/tts_speaker.cc b/bin/tts/tts_speaker.cc
index 365633f..dee29ed 100644
--- a/bin/tts/tts_speaker.cc
+++ b/bin/tts/tts_speaker.cc
@@ -5,7 +5,6 @@
 #include <lib/async/cpp/task.h>
 
 #include "garnet/bin/tts/tts_speaker.h"
-#include "lib/fxl/functional/make_copyable.h"
 
 namespace tts {
 
@@ -141,10 +140,10 @@
 
     if (eos && (todo == bytes_to_send)) {
       audio_renderer_->SendPacket(
-          std::move(pkt), fxl::MakeCopyable([speak_complete_cbk = std::move(
-                                                 speak_complete_cbk_)]() {
+          std::move(pkt),
+          [speak_complete_cbk = std::move(speak_complete_cbk_)]() {
             speak_complete_cbk();
-          }));
+          });
     } else if (todo == bytes_till_low_water) {
       audio_renderer_->SendPacket(
           std::move(pkt), [thiz = shared_from_this(), new_rd_pos = tx_ptr_]() {
diff --git a/bin/ui/root_presenter/app.cc b/bin/ui/root_presenter/app.cc
index e6d916a..f67ae84 100644
--- a/bin/ui/root_presenter/app.cc
+++ b/bin/ui/root_presenter/app.cc
@@ -13,7 +13,6 @@
 #include "lib/component/cpp/connect.h"
 #include "lib/fidl/cpp/clone.h"
 #include "lib/fxl/files/file.h"
-#include "lib/fxl/functional/make_copyable.h"
 #include "lib/fxl/logging.h"
 #include "lib/ui/input/cpp/formatting.h"
 
@@ -37,18 +36,18 @@
 App::~App() {}
 
 Presentation::YieldCallback App::GetYieldCallback() {
-  return fxl::MakeCopyable([this](bool yield_to_next) {
+  return [this](bool yield_to_next) {
     if (yield_to_next) {
       SwitchToNextPresentation();
     } else {
       SwitchToPreviousPresentation();
     }
-  });
+  };
 }
 
 Presentation::ShutdownCallback App::GetShutdownCallback(
     Presentation* presentation) {
-  return fxl::MakeCopyable([this, presentation] {
+  return [this, presentation] {
     size_t idx;
     for (idx = 0; idx < presentations_.size(); ++idx) {
       if (presentations_[idx].get() == presentation) {
@@ -74,7 +73,7 @@
       layer_stack_->RemoveAllLayers();
       active_presentation_idx_ = std::numeric_limits<size_t>::max();
     }
-  });
+  };
 }
 
 void App::Present2(zx::eventpair view_holder_token,
diff --git a/bin/ui/root_presenter/presentation1.cc b/bin/ui/root_presenter/presentation1.cc
index dfe1a80..35ae1d4 100644
--- a/bin/ui/root_presenter/presentation1.cc
+++ b/bin/ui/root_presenter/presentation1.cc
@@ -22,7 +22,6 @@
 #include <glm/gtc/type_ptr.hpp>
 
 #include "lib/component/cpp/connect.h"
-#include "lib/fxl/functional/make_copyable.h"
 #include "lib/fxl/logging.h"
 #include "lib/ui/input/cpp/formatting.h"
 #include "lib/ui/views/cpp/formatting.h"
@@ -199,7 +198,7 @@
   yield_callback_ = std::move(yield_callback);
   shutdown_callback_ = std::move(shutdown_callback);
 
-  scenic_->GetDisplayInfo(fxl::MakeCopyable(
+  scenic_->GetDisplayInfo(
       [weak = weak_factory_.GetWeakPtr(),
        presentation_request = std::move(presentation_request)](
           fuchsia::ui::gfx::DisplayInfo display_info) mutable {
@@ -210,7 +209,7 @@
           weak->InitializeDisplayModel(std::move(display_info));
           weak->PresentScene();
         }
-      }));
+      });
 }
 
 void Presentation1::InitializeDisplayModel(
diff --git a/bin/ui/root_presenter/presentation2.cc b/bin/ui/root_presenter/presentation2.cc
index 8a0cdc4..d4ce71a 100644
--- a/bin/ui/root_presenter/presentation2.cc
+++ b/bin/ui/root_presenter/presentation2.cc
@@ -22,7 +22,6 @@
 #include <glm/gtc/type_ptr.hpp>
 
 #include "lib/component/cpp/connect.h"
-#include "lib/fxl/functional/make_copyable.h"
 #include "lib/fxl/logging.h"
 #include "lib/ui/input/cpp/formatting.h"
 #include "lib/ui/scenic/cpp/id.h"
@@ -133,7 +132,7 @@
   yield_callback_ = std::move(yield_callback);
   shutdown_callback_ = std::move(shutdown_callback);
 
-  scenic_->GetDisplayInfo(fxl::MakeCopyable(
+  scenic_->GetDisplayInfo(
       [weak = weak_factory_.GetWeakPtr(),
        presentation_request = std::move(presentation_request)](
           fuchsia::ui::gfx::DisplayInfo display_info) mutable {
@@ -147,7 +146,7 @@
 
           weak->PresentScene();
         }
-      }));
+      });
 }
 
 void Presentation2::InitializeDisplayModel(
diff --git a/bin/ui/view_manager/view_registry.cc b/bin/ui/view_manager/view_registry.cc
index f166088..74a0fe1 100644
--- a/bin/ui/view_manager/view_registry.cc
+++ b/bin/ui/view_manager/view_registry.cc
@@ -17,7 +17,6 @@
 #include "garnet/bin/ui/view_manager/view_tree_impl.h"
 #include "garnet/public/lib/escher/util/type_utils.h"
 #include "lib/component/cpp/connect.h"
-#include "lib/fxl/functional/make_copyable.h"
 #include "lib/fxl/logging.h"
 #include "lib/fxl/memory/weak_ptr.h"
 #include "lib/fxl/strings/string_printf.h"
diff --git a/drivers/bluetooth/host/fidl/gatt_server_server.cc b/drivers/bluetooth/host/fidl/gatt_server_server.cc
index 5b29049..2d3e974 100644
--- a/drivers/bluetooth/host/fidl/gatt_server_server.cc
+++ b/drivers/bluetooth/host/fidl/gatt_server_server.cc
@@ -13,8 +13,6 @@
 
 #include "helpers.h"
 
-#include "lib/fxl/functional/make_copyable.h"
-
 using fuchsia::bluetooth::ErrorCode;
 using fuchsia::bluetooth::Status;
 using GattErrorCode = fuchsia::bluetooth::gatt::ErrorCode;
@@ -340,7 +338,7 @@
 
   auto* delegate = iter->second->delegate();
   ZX_DEBUG_ASSERT(delegate);
-  delegate->OnReadValue(id, offset, fxl::MakeCopyable(std::move(cb)));
+  delegate->OnReadValue(id, offset, std::move(cb));
 }
 
 void GattServerServer::OnWriteRequest(::btlib::gatt::IdType service_id,
@@ -366,8 +364,7 @@
     responder(GattErrorCodeFromFidl(error_code, false /* is_read */));
   };
 
-  delegate->OnWriteValue(id, offset, std::move(fidl_value),
-                         fxl::MakeCopyable(std::move(cb)));
+  delegate->OnWriteValue(id, offset, std::move(fidl_value), std::move(cb));
 }
 
 void GattServerServer::OnCharacteristicConfig(::btlib::gatt::IdType service_id,
diff --git a/drivers/bluetooth/lib/gap/bredr_interrogator.cc b/drivers/bluetooth/lib/gap/bredr_interrogator.cc
index cefa918..3c20657 100644
--- a/drivers/bluetooth/lib/gap/bredr_interrogator.cc
+++ b/drivers/bluetooth/lib/gap/bredr_interrogator.cc
@@ -163,42 +163,40 @@
   auto it = pending_.find(device_id);
   ZX_DEBUG_ASSERT(it != pending_.end());
 
-  it->second->callbacks.emplace_back(
-      [device_id, self = weak_ptr_factory_.GetWeakPtr()](auto,
-                                                         const auto& event) {
-        if (hci_is_error(event, WARN, "gap-bredr",
-                         "remote name request failed")) {
-          self->Complete(device_id, event.ToStatus());
-          return;
-        }
+  it->second->callbacks.emplace_back([device_id,
+                                      self = weak_ptr_factory_.GetWeakPtr()](
+                                         auto, const auto& event) {
+    if (hci_is_error(event, WARN, "gap-bredr", "remote name request failed")) {
+      self->Complete(device_id, event.ToStatus());
+      return;
+    }
 
-        if (event.event_code() == hci::kCommandStatusEventCode) {
-          return;
-        }
+    if (event.event_code() == hci::kCommandStatusEventCode) {
+      return;
+    }
 
-        ZX_DEBUG_ASSERT(event.event_code() ==
-                        hci::kRemoteNameRequestCompleteEventCode);
+    ZX_DEBUG_ASSERT(event.event_code() ==
+                    hci::kRemoteNameRequestCompleteEventCode);
 
-        const auto& params =
-            event.view()
-                .template payload<hci::RemoteNameRequestCompleteEventParams>();
+    const auto& params =
+        event.view()
+            .template payload<hci::RemoteNameRequestCompleteEventParams>();
 
-        size_t len = 0;
-        for (; len < hci::kMaxNameLength; len++) {
-          if (params.remote_name[len] == 0) {
-            break;
-          }
-        }
-        RemoteDevice* device = self->cache_->FindDeviceById(device_id);
-        if (!device) {
-          self->Complete(device_id, hci::Status(common::HostError::kFailed));
-          return;
-        }
-        device->SetName(
-            std::string(params.remote_name, params.remote_name + len));
+    size_t len = 0;
+    for (; len < hci::kMaxNameLength; len++) {
+      if (params.remote_name[len] == 0) {
+        break;
+      }
+    }
+    RemoteDevice* device = self->cache_->FindDeviceById(device_id);
+    if (!device) {
+      self->Complete(device_id, hci::Status(common::HostError::kFailed));
+      return;
+    }
+    device->SetName(std::string(params.remote_name, params.remote_name + len));
 
-        self->MaybeComplete(device_id);
-      });
+    self->MaybeComplete(device_id);
+  });
 
   bt_log(SPEW, "gap-bredr", "name request %s",
          device->address().ToString().c_str());
@@ -325,49 +323,48 @@
   auto it = pending_.find(device_id);
   ZX_DEBUG_ASSERT(it != pending_.end());
 
-  it->second->callbacks.emplace_back(
-      [device_id, handle, page, self = weak_ptr_factory_.GetWeakPtr()](
-          auto, const auto& event) {
-        if (hci_is_error(event, WARN, "gap-bredr",
-                         "read remote extended features failed")) {
-          self->Complete(device_id, event.ToStatus());
-          return;
-        }
+  it->second->callbacks.emplace_back([device_id, handle, page,
+                                      self = weak_ptr_factory_.GetWeakPtr()](
+                                         auto, const auto& event) {
+    if (hci_is_error(event, WARN, "gap-bredr",
+                     "read remote extended features failed")) {
+      self->Complete(device_id, event.ToStatus());
+      return;
+    }
 
-        if (event.event_code() == hci::kCommandStatusEventCode) {
-          return;
-        }
+    if (event.event_code() == hci::kCommandStatusEventCode) {
+      return;
+    }
 
-        ZX_DEBUG_ASSERT(event.event_code() ==
-                        hci::kReadRemoteExtendedFeaturesCompleteEventCode);
+    ZX_DEBUG_ASSERT(event.event_code() ==
+                    hci::kReadRemoteExtendedFeaturesCompleteEventCode);
 
-        const auto& params =
-            event.view()
-                .template payload<
-                    hci::ReadRemoteExtendedFeaturesCompleteEventParams>();
+    const auto& params =
+        event.view()
+            .template payload<
+                hci::ReadRemoteExtendedFeaturesCompleteEventParams>();
 
-        RemoteDevice* device = self->cache_->FindDeviceById(device_id);
-        if (!device) {
-          self->Complete(device_id, hci::Status(common::HostError::kFailed));
-          return;
-        }
-        device->SetFeaturePage(params.page_number,
-                               le64toh(params.lmp_features));
-        if (params.page_number != page) {
-          bt_log(INFO, "gap-bredr",
-                 "requested page %u and received page %u, giving up", page,
-                 params.page_number);
-          device->set_last_page_number(0);
-        } else {
-          device->set_last_page_number(params.max_page_number);
-        }
+    RemoteDevice* device = self->cache_->FindDeviceById(device_id);
+    if (!device) {
+      self->Complete(device_id, hci::Status(common::HostError::kFailed));
+      return;
+    }
+    device->SetFeaturePage(params.page_number, le64toh(params.lmp_features));
+    if (params.page_number != page) {
+      bt_log(INFO, "gap-bredr",
+             "requested page %u and received page %u, giving up", page,
+             params.page_number);
+      device->set_last_page_number(0);
+    } else {
+      device->set_last_page_number(params.max_page_number);
+    }
 
-        if (params.page_number < device->features().last_page_number()) {
-          self->ReadRemoteExtendedFeatures(device_id, handle,
-                                           params.page_number + 1);
-        }
-        self->MaybeComplete(device_id);
-      });
+    if (params.page_number < device->features().last_page_number()) {
+      self->ReadRemoteExtendedFeatures(device_id, handle,
+                                       params.page_number + 1);
+    }
+    self->MaybeComplete(device_id);
+  });
 
   bt_log(SPEW, "gap-bredr", "get ext page %u", page);
   hci_->command_channel()->SendCommand(
diff --git a/drivers/bluetooth/lib/gap/bredr_interrogator.h b/drivers/bluetooth/lib/gap/bredr_interrogator.h
index 0ad1362..427574a 100644
--- a/drivers/bluetooth/lib/gap/bredr_interrogator.h
+++ b/drivers/bluetooth/lib/gap/bredr_interrogator.h
@@ -9,6 +9,7 @@
 
 #include <lib/async/cpp/task.h>
 #include <lib/async/dispatcher.h>
+#include <lib/fit/function.h>
 
 #include "garnet/drivers/bluetooth/lib/common/device_address.h"
 #include "garnet/drivers/bluetooth/lib/gap/remote_device_cache.h"
@@ -51,7 +52,7 @@
   // Starts interrogation. Calls |callback| when the sequence is completed or
   // abandoned.
   using ResultCallback =
-      std::function<void(hci::Status status, hci::ConnectionPtr conn_ptr)>;
+      fit::function<void(hci::Status status, hci::ConnectionPtr conn_ptr)>;
   void Start(const std::string& device_id, hci::ConnectionPtr conn_ptr,
              ResultCallback callback);
 
diff --git a/drivers/bluetooth/lib/testing/fake_controller.cc b/drivers/bluetooth/lib/testing/fake_controller.cc
index 061532e..44e2a54 100644
--- a/drivers/bluetooth/lib/testing/fake_controller.cc
+++ b/drivers/bluetooth/lib/testing/fake_controller.cc
@@ -199,9 +199,8 @@
   devices_.push_back(std::move(device));
 }
 
-void FakeController::SetScanStateCallback(
-    ScanStateCallback callback,
-    async_dispatcher_t* dispatcher) {
+void FakeController::SetScanStateCallback(ScanStateCallback callback,
+                                          async_dispatcher_t* dispatcher) {
   ZX_DEBUG_ASSERT(callback);
   ZX_DEBUG_ASSERT(dispatcher);
 
@@ -210,8 +209,7 @@
 }
 
 void FakeController::SetAdvertisingStateCallback(
-    fit::closure callback,
-    async_dispatcher_t* dispatcher) {
+    fit::closure callback, async_dispatcher_t* dispatcher) {
   ZX_DEBUG_ASSERT(callback);
   ZX_DEBUG_ASSERT(dispatcher);
 
@@ -220,8 +218,7 @@
 }
 
 void FakeController::SetConnectionStateCallback(
-    ConnectionStateCallback callback,
-    async_dispatcher_t* dispatcher) {
+    ConnectionStateCallback callback, async_dispatcher_t* dispatcher) {
   ZX_DEBUG_ASSERT(callback);
   ZX_DEBUG_ASSERT(dispatcher);
 
@@ -230,8 +227,7 @@
 }
 
 void FakeController::SetLEConnectionParametersCallback(
-    LEConnectionParametersCallback callback,
-    async_dispatcher_t* dispatcher) {
+    LEConnectionParametersCallback callback, async_dispatcher_t* dispatcher) {
   ZX_DEBUG_ASSERT(callback);
   ZX_DEBUG_ASSERT(dispatcher);
 
@@ -434,34 +430,34 @@
 void FakeController::L2CAPConnectionParameterUpdate(
     const common::DeviceAddress& addr,
     const hci::LEPreferredConnectionParameters& params) {
-      async::PostTask(dispatcher(), [addr, params, this] {
-        FakeDevice* dev = FindDeviceByAddress(addr);
-        if (!dev) {
-          bt_log(WARN, "fake-hci", "no device found with address: %s",
-                 addr.ToString().c_str());
-          return;
-        }
+  async::PostTask(dispatcher(), [addr, params, this] {
+    FakeDevice* dev = FindDeviceByAddress(addr);
+    if (!dev) {
+      bt_log(WARN, "fake-hci", "no device found with address: %s",
+             addr.ToString().c_str());
+      return;
+    }
 
-        if (!dev->connected()) {
-          bt_log(WARN, "fake-hci", "device not connected");
-          return;
-        }
+    if (!dev->connected()) {
+      bt_log(WARN, "fake-hci", "device not connected");
+      return;
+    }
 
-        ZX_DEBUG_ASSERT(!dev->logical_links().empty());
+    ZX_DEBUG_ASSERT(!dev->logical_links().empty());
 
-        l2cap::ConnectionParameterUpdateRequestPayload payload;
-        payload.interval_min = htole16(params.min_interval());
-        payload.interval_max = htole16(params.max_interval());
-        payload.slave_latency = htole16(params.max_latency());
-        payload.timeout_multiplier = htole16(params.supervision_timeout());
+    l2cap::ConnectionParameterUpdateRequestPayload payload;
+    payload.interval_min = htole16(params.min_interval());
+    payload.interval_max = htole16(params.max_interval());
+    payload.slave_latency = htole16(params.max_latency());
+    payload.timeout_multiplier = htole16(params.supervision_timeout());
 
-        // TODO(armansito): Instead of picking the first handle we should pick
-        // the handle that matches the current LE-U link.
-        SendL2CAPCFrame(*dev->logical_links().begin(), true,
-                        l2cap::kConnectionParameterUpdateRequest,
-                        NextL2CAPCommandId(),
-                        BufferView(&payload, sizeof(payload)));
-      });
+    // TODO(armansito): Instead of picking the first handle we should pick
+    // the handle that matches the current LE-U link.
+    SendL2CAPCFrame(*dev->logical_links().begin(), true,
+                    l2cap::kConnectionParameterUpdateRequest,
+                    NextL2CAPCommandId(),
+                    BufferView(&payload, sizeof(payload)));
+  });
 }
 
 void FakeController::Disconnect(const common::DeviceAddress& addr) {
@@ -556,19 +552,20 @@
   }
 
   ZX_DEBUG_ASSERT(advertising_state_cb_dispatcher_);
-  async::PostTask(advertising_state_cb_dispatcher_, advertising_state_cb_.share());
+  async::PostTask(advertising_state_cb_dispatcher_,
+                  advertising_state_cb_.share());
 }
 
 void FakeController::NotifyConnectionState(const common::DeviceAddress& addr,
-                                           bool connected,
-                                           bool canceled) {
+                                           bool connected, bool canceled) {
   if (!conn_state_cb_)
     return;
 
   ZX_DEBUG_ASSERT(conn_state_cb_dispatcher_);
-  async::PostTask(conn_state_cb_dispatcher_, [
-    addr, connected, canceled, cb = conn_state_cb_.share()
-  ] { cb(addr, connected, canceled); });
+  async::PostTask(conn_state_cb_dispatcher_,
+                  [addr, connected, canceled, cb = conn_state_cb_.share()] {
+                    cb(addr, connected, canceled);
+                  });
 }
 
 void FakeController::NotifyLEConnectionParameters(
@@ -578,7 +575,8 @@
     return;
 
   ZX_DEBUG_ASSERT(le_conn_params_cb_dispatcher_);
-  async::PostTask(le_conn_params_cb_dispatcher_,
+  async::PostTask(
+      le_conn_params_cb_dispatcher_,
       [addr, params, cb = le_conn_params_cb_.share()] { cb(addr, params); });
 }
 
@@ -679,7 +677,7 @@
                     BufferView(&response, sizeof(response)));
   });
   async::PostTask(dispatcher(),
-      [cb = pending_le_connect_rsp_.callback()] { cb(); });
+                  [cb = pending_le_connect_rsp_.callback()] { cb(); });
 }
 
 void FakeController::OnLEConnectionUpdateCommandReceived(
@@ -1146,9 +1144,9 @@
       // state update BEFORE the HCI command sequence terminates.
       if (scan_state_cb_) {
         ZX_DEBUG_ASSERT(scan_state_cb_dispatcher_);
-        async::PostTask(scan_state_cb_dispatcher_, [
-          cb = scan_state_cb_.share(), enabled = le_scan_state_.enabled
-        ] { cb(enabled); });
+        async::PostTask(scan_state_cb_dispatcher_,
+                        [cb = scan_state_cb_.share(),
+                         enabled = le_scan_state_.enabled] { cb(enabled); });
       }
 
       RespondWithSuccess(opcode);
diff --git a/drivers/gpu/msd-intel-gen/tests/unit_tests/BUILD.gn b/drivers/gpu/msd-intel-gen/tests/unit_tests/BUILD.gn
index 0f4ecab..d1b9726 100644
--- a/drivers/gpu/msd-intel-gen/tests/unit_tests/BUILD.gn
+++ b/drivers/gpu/msd-intel-gen/tests/unit_tests/BUILD.gn
@@ -70,10 +70,11 @@
     "$magma_build_root/src/magma_util/platform:semaphore",
     "$magma_build_root/tests/helper:command_buffer_helper",
     "$magma_build_root/tests/helper:platform_device_helper",
-    "$magma_build_root/tests/mock:mmio",
     "$magma_build_root/tests/mock:bus_mapper",
+    "$magma_build_root/tests/mock:mmio",
     "$msd_intel_gen_build_root/src",
     "$msd_intel_gen_build_root/tests/mock",
     "//third_party/googletest:gtest",
+    "//zircon/public/lib/fit",
   ]
 }
diff --git a/drivers/video/amlogic-decoder/h264_decoder.cc b/drivers/video/amlogic-decoder/h264_decoder.cc
index d747013..f3a30f6 100644
--- a/drivers/video/amlogic-decoder/h264_decoder.cc
+++ b/drivers/video/amlogic-decoder/h264_decoder.cc
@@ -375,11 +375,11 @@
 }
 
 void H264Decoder::SetFrameReadyNotifier(FrameReadyNotifier notifier) {
-  notifier_ = notifier;
+  notifier_ = std::move(notifier);
 }
 
 void H264Decoder::SetInitializeFramesHandler(InitializeFramesHandler handler) {
-  initialize_frames_handler_ = handler;
+  initialize_frames_handler_ = std::move(handler);
 }
 
 void H264Decoder::SetErrorHandler(fit::closure error_handler) {
diff --git a/drivers/video/amlogic-decoder/local_codec_factory.cc b/drivers/video/amlogic-decoder/local_codec_factory.cc
index 438e6e9..b5e04f2 100644
--- a/drivers/video/amlogic-decoder/local_codec_factory.cc
+++ b/drivers/video/amlogic-decoder/local_codec_factory.cc
@@ -11,6 +11,7 @@
 #include "codec_adapter_vp9.h"
 
 #include <lib/fidl/cpp/clone.h>
+#include <lib/fit/function.h>
 #include <lib/media/codec_impl/codec_admission_control.h>
 #include <optional>
 
@@ -21,7 +22,7 @@
 
   // This typedef is just for local readability here, not for use outside this
   // struct.
-  using CreateFunction = std::function<std::unique_ptr<CodecAdapter>(
+  using CreateFunction = fit::function<std::unique_ptr<CodecAdapter>(
       std::mutex& lock, CodecAdapterEvents*, DeviceCtx*)>;
 
   bool multi_instance;
diff --git a/drivers/video/amlogic-decoder/mpeg12_decoder.cc b/drivers/video/amlogic-decoder/mpeg12_decoder.cc
index be70dce..346de67 100644
--- a/drivers/video/amlogic-decoder/mpeg12_decoder.cc
+++ b/drivers/video/amlogic-decoder/mpeg12_decoder.cc
@@ -42,7 +42,7 @@
 }
 
 void Mpeg12Decoder::SetFrameReadyNotifier(FrameReadyNotifier notifier) {
-  notifier_ = notifier;
+  notifier_ = std::move(notifier);
 }
 
 void Mpeg12Decoder::ResetHardware() {
diff --git a/drivers/video/amlogic-decoder/video_decoder.h b/drivers/video/amlogic-decoder/video_decoder.h
index 3a5de31..fdb29a1 100644
--- a/drivers/video/amlogic-decoder/video_decoder.h
+++ b/drivers/video/amlogic-decoder/video_decoder.h
@@ -10,6 +10,7 @@
 #include <ddk/device.h>
 #include <ddk/driver.h>
 #include <fuchsia/mediacodec/cpp/fidl.h>
+#include <lib/fit/function.h>
 #include <lib/media/codec_impl/codec_frame.h>
 #include <lib/zx/bti.h>
 #include <zircon/assert.h>
@@ -63,9 +64,9 @@
   // In actual operation, the FrameReadyNotifier must not keep a reference on
   // the frame shared_ptr<>, as that would interfere with muting calls to
   // ReturnFrame().  See comment on Vp9Decoder::Frame::frame field.
-  using FrameReadyNotifier = std::function<void(std::shared_ptr<VideoFrame>)>;
+  using FrameReadyNotifier = fit::function<void(std::shared_ptr<VideoFrame>)>;
   using InitializeFramesHandler =
-      std::function<zx_status_t(::zx::bti,
+      fit::function<zx_status_t(::zx::bti,
                                 uint32_t,  // frame_count
                                 uint32_t,  // width
                                 uint32_t,  // height
diff --git a/drivers/video/amlogic-decoder/vp9_decoder.cc b/drivers/video/amlogic-decoder/vp9_decoder.cc
index 9adfe6a..6bb87b7 100644
--- a/drivers/video/amlogic-decoder/vp9_decoder.cc
+++ b/drivers/video/amlogic-decoder/vp9_decoder.cc
@@ -984,7 +984,7 @@
 }
 
 void Vp9Decoder::SetFrameReadyNotifier(FrameReadyNotifier notifier) {
-  notifier_ = notifier;
+  notifier_ = std::move(notifier);
 }
 
 void Vp9Decoder::SetCheckOutputReady(CheckOutputReady check_output_ready) {
@@ -1289,7 +1289,7 @@
 }
 
 void Vp9Decoder::SetInitializeFramesHandler(InitializeFramesHandler handler) {
-  initialize_frames_handler_ = handler;
+  initialize_frames_handler_ = std::move(handler);
 }
 
 void Vp9Decoder::SetErrorHandler(fit::closure error_handler) {
diff --git a/examples/media/fx/fx.cpp b/examples/media/fx/fx.cpp
index b47e0d8..c06ee37 100644
--- a/examples/media/fx/fx.cpp
+++ b/examples/media/fx/fx.cpp
@@ -16,12 +16,12 @@
 #include <lib/zx/time.h>
 #include <lib/zx/vmar.h>
 #include <lib/zx/vmo.h>
-#include <limits>
 #include <stdio.h>
-#include <utility>
 #include <zircon/compiler.h>
 #include <zircon/errors.h>
 #include <zircon/types.h>
+#include <limits>
+#include <utility>
 
 #include "lib/component/cpp/connect.h"
 #include "lib/component/cpp/startup_context.h"
@@ -328,7 +328,8 @@
 }
 
 void FxProcessor::RequestKeystrokeMessage() {
-  keystroke_waiter_.Wait(handle_keystroke_thunk_, STDIN_FILENO, POLLIN);
+  keystroke_waiter_.Wait(std::move(handle_keystroke_thunk_), STDIN_FILENO,
+                         POLLIN);
 }
 
 void FxProcessor::HandleKeystroke(zx_status_t status, uint32_t events) {
@@ -479,9 +480,9 @@
   }
 
   // Schedule our next processing callback.
-  async::PostDelayedTask(async_get_default_dispatcher(),
-                         [this]() { ProcessInput(); },
-                         zx::nsec(PROCESS_CHUNK_TIME));
+  async::PostDelayedTask(
+      async_get_default_dispatcher(), [this]() { ProcessInput(); },
+      zx::nsec(PROCESS_CHUNK_TIME));
 }
 
 void FxProcessor::ProduceOutputPackets(fuchsia::media::StreamPacket* out_pkt1,
diff --git a/examples/ui/hello_views/example_view_provider_service.cc b/examples/ui/hello_views/example_view_provider_service.cc
index 5368144..cfcde6b 100644
--- a/examples/ui/hello_views/example_view_provider_service.cc
+++ b/examples/ui/hello_views/example_view_provider_service.cc
@@ -9,26 +9,30 @@
 #include <lib/zx/eventpair.h>
 
 #include "lib/component/cpp/startup_context.h"
+#include "lib/fxl/logging.h"
 #include "lib/ui/scenic/cpp/resources.h"
 #include "lib/ui/scenic/cpp/session.h"
-#include "lib/fxl/logging.h"
 
 namespace hello_views {
 
 ExampleViewProviderService::ExampleViewProviderService(
     component::StartupContext* startup_ctx, ViewFactory factory)
-    : startup_ctx_(startup_ctx), view_factory_fn_(factory) {
+    : startup_ctx_(startup_ctx), view_factory_fn_(std::move(factory)) {
   FXL_DCHECK(startup_ctx_);
 
-  startup_ctx->outgoing().deprecated_services()->AddService<fuchsia::ui::app::ViewProvider>(
-      [this](fidl::InterfaceRequest<fuchsia::ui::app::ViewProvider> request) {
-        bindings_.AddBinding(this, std::move(request));
-      },
-      "view_provider");
+  startup_ctx->outgoing()
+      .deprecated_services()
+      ->AddService<fuchsia::ui::app::ViewProvider>(
+          [this](
+              fidl::InterfaceRequest<fuchsia::ui::app::ViewProvider> request) {
+            bindings_.AddBinding(this, std::move(request));
+          },
+          "view_provider");
 }
 
 ExampleViewProviderService::~ExampleViewProviderService() {
-  startup_ctx_->outgoing().deprecated_services()
+  startup_ctx_->outgoing()
+      .deprecated_services()
       ->RemoveService<fuchsia::ui::app::ViewProvider>();
 }
 
diff --git a/examples/ui/hello_views/example_view_provider_service.h b/examples/ui/hello_views/example_view_provider_service.h
index 68522de..db775e5 100644
--- a/examples/ui/hello_views/example_view_provider_service.h
+++ b/examples/ui/hello_views/example_view_provider_service.h
@@ -2,11 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef GARNET_EXAMPLES_UI_HELLO_VIEWS_VIEW_PROVIDER_SERVICE_H_
-#define GARNET_EXAMPLES_UI_HELLO_VIEWS_VIEW_PROVIDER_SERVICE_H_
+#ifndef GARNET_EXAMPLES_UI_HELLO_VIEWS_EXAMPLE_VIEW_PROVIDER_SERVICE_H_
+#define GARNET_EXAMPLES_UI_HELLO_VIEWS_EXAMPLE_VIEW_PROVIDER_SERVICE_H_
 
 #include <fuchsia/sys/cpp/fidl.h>
 #include <fuchsia/ui/app/cpp/fidl.h>
+#include <lib/fit/function.h>
 #include <lib/zx/eventpair.h>
 
 #include "lib/component/cpp/startup_context.h"
@@ -25,7 +26,7 @@
 
 // A callback to create a view in response to a call to
 // |ViewProvider.CreateView()|.
-using ViewFactory = std::function<void(ViewContext context)>;
+using ViewFactory = fit::function<void(ViewContext context)>;
 
 // A basic implementation of the |ViewProvider| interface which Scenic clients
 // can use to create and expose custom Views to other Scenic clients.
@@ -56,4 +57,4 @@
 
 }  // namespace hello_views
 
-#endif  // GARNET_EXAMPLES_UI_HELLO_VIEWS_VIEW_PROVIDER_SERVICE_H_
+#endif  // GARNET_EXAMPLES_UI_HELLO_VIEWS_EXAMPLE_VIEW_PROVIDER_SERVICE_H_
diff --git a/lib/cpuperf/file_reader.h b/lib/cpuperf/file_reader.h
index 57e3ba8..4e67cc9 100644
--- a/lib/cpuperf/file_reader.h
+++ b/lib/cpuperf/file_reader.h
@@ -10,6 +10,7 @@
 #include <functional>
 #include <string>
 
+#include <lib/fit/function.h>
 #include <lib/fxl/files/unique_fd.h>
 #include <lib/fxl/macros.h>
 #include <lib/zircon-internal/device/cpu-trace/cpu-perf.h>
@@ -21,7 +22,7 @@
 
 class FileReader final : public Reader {
  public:
-  using FileNameProducer = std::function<std::string(uint32_t trace_num)>;
+  using FileNameProducer = fit::function<std::string(uint32_t trace_num)>;
 
   static bool Create(FileNameProducer file_name_producer, uint32_t num_traces,
                      std::unique_ptr<FileReader>* out_reader);
diff --git a/lib/magma/src/magma_util/BUILD.gn b/lib/magma/src/magma_util/BUILD.gn
index 36b009c..b5f2a6d 100644
--- a/lib/magma/src/magma_util/BUILD.gn
+++ b/lib/magma/src/magma_util/BUILD.gn
@@ -85,7 +85,9 @@
 }
 
 group("system") {
-  public_deps = [ ":allocator" ]
+  public_deps = [
+    ":allocator",
+  ]
 }
 
 source_set("allocator") {
@@ -104,6 +106,7 @@
 
   public_deps = [
     ":common",
+    "//zircon/public/lib/fit",
   ]
 }
 
diff --git a/lib/magma/src/magma_util/platform/BUILD.gn b/lib/magma/src/magma_util/platform/BUILD.gn
index c5d5bba..81a8c57 100644
--- a/lib/magma/src/magma_util/platform/BUILD.gn
+++ b/lib/magma/src/magma_util/platform/BUILD.gn
@@ -297,6 +297,7 @@
 
   public_deps = [
     "zircon:trace",
+    "//zircon/public/lib/fit",
   ]
 
   allow_circular_includes_from = [ "zircon:trace" ]
diff --git a/lib/magma/src/magma_util/platform/platform_trace.h b/lib/magma/src/magma_util/platform/platform_trace.h
index e2e4d64..04fddb1 100644
--- a/lib/magma/src/magma_util/platform/platform_trace.h
+++ b/lib/magma/src/magma_util/platform/platform_trace.h
@@ -7,6 +7,8 @@
 
 #include <functional>
 
+#include <lib/fit/function.h>
+
 #if MAGMA_ENABLE_TRACING
 #include "trace-vthread/event_vthread.h"
 #include <trace/event.h>
@@ -52,7 +54,7 @@
     virtual bool Initialize() = 0;
 
     // Invokes the given |callback| (on a different thread) when the tracing state changes.
-    virtual void SetObserver(std::function<void(bool trace_enabled)> callback) = 0;
+    virtual void SetObserver(fit::function<void(bool trace_enabled)> callback) = 0;
 };
 
 } // namespace magma
diff --git a/lib/magma/src/magma_util/platform/zircon/BUILD.gn b/lib/magma/src/magma_util/platform/zircon/BUILD.gn
index 42f257a..60ed4a6 100644
--- a/lib/magma/src/magma_util/platform/zircon/BUILD.gn
+++ b/lib/magma/src/magma_util/platform/zircon/BUILD.gn
@@ -250,6 +250,7 @@
 
   deps = [
     "$magma_build_root/src/magma_util",
+    "$zircon_build_root/public/lib/fit",
     "$zircon_build_root/public/lib/zx",
   ]
 }
@@ -269,8 +270,12 @@
     "$magma_build_root/src/magma_util",
   ]
 
+  public_deps = [
+    "//zircon/public/lib/fit",
+  ]
+
   if (magma_enable_tracing) {
-    public_deps = [
+    public_deps += [
       "$zircon_build_root/public/lib/async-cpp",
       "$zircon_build_root/public/lib/async-loop-cpp",
       "$zircon_build_root/public/lib/trace",
diff --git a/lib/magma/src/magma_util/platform/zircon/zircon_platform_trace.cc b/lib/magma/src/magma_util/platform/zircon/zircon_platform_trace.cc
index 82076ae..627874f 100644
--- a/lib/magma/src/magma_util/platform/zircon/zircon_platform_trace.cc
+++ b/lib/magma/src/magma_util/platform/zircon/zircon_platform_trace.cc
@@ -6,6 +6,8 @@
 
 #include <memory>
 
+#include <lib/fit/function.h>
+
 #include "magma_util/dlog.h"
 #include "magma_util/macros.h"
 
@@ -48,12 +50,12 @@
     return true;
 }
 
-void ZirconPlatformTraceObserver::SetObserver(std::function<void(bool)> callback)
+void ZirconPlatformTraceObserver::SetObserver(fit::function<void(bool)> callback)
 {
     observer_.Stop();
     enabled_ = false;
 
-    observer_.Start(loop_.dispatcher(), [this, callback] {
+    observer_.Start(loop_.dispatcher(), [this, callback = std::move(callback)] {
         bool enabled = trace_state() == TRACE_STARTED;
         if (this->enabled_ != enabled) {
             this->enabled_ = enabled;
diff --git a/lib/magma/src/magma_util/platform/zircon/zircon_platform_trace.h b/lib/magma/src/magma_util/platform/zircon/zircon_platform_trace.h
index 519b570..b264bf9 100644
--- a/lib/magma/src/magma_util/platform/zircon/zircon_platform_trace.h
+++ b/lib/magma/src/magma_util/platform/zircon/zircon_platform_trace.h
@@ -5,6 +5,8 @@
 #ifndef ZIRCON_PLATFORM_TRACE_H
 #define ZIRCON_PLATFORM_TRACE_H
 
+#include <lib/fit/function.h>
+
 #if MAGMA_ENABLE_TRACING
 #include <lib/async-loop/cpp/loop.h>
 #include <trace-provider/provider.h>
@@ -36,7 +38,7 @@
     bool Initialize() override;
 
     // Can only have one observer
-    void SetObserver(std::function<void(bool)> callback) override;
+    void SetObserver(fit::function<void(bool)> callback) override;
 
 private:
     async::Loop loop_;
diff --git a/lib/magma/src/magma_util/retry_allocator.h b/lib/magma/src/magma_util/retry_allocator.h
index 0b72c93..4dff428 100644
--- a/lib/magma/src/magma_util/retry_allocator.h
+++ b/lib/magma/src/magma_util/retry_allocator.h
@@ -7,6 +7,8 @@
 
 #include <map>
 
+#include <lib/fit/function.h>
+
 #include "macros.h"
 
 namespace magma {
@@ -16,7 +18,7 @@
 // space.
 class RetryAllocator final {
 public:
-    using AllocationFunction = std::function<bool(uint64_t)>;
+    using AllocationFunction = fit::function<bool(uint64_t)>;
 
     static std::unique_ptr<RetryAllocator> Create(uint64_t base, uint64_t size);
 
diff --git a/lib/magma/src/sys_driver/BUILD.gn b/lib/magma/src/sys_driver/BUILD.gn
index 2dd361e..eadf3c2 100644
--- a/lib/magma/src/sys_driver/BUILD.gn
+++ b/lib/magma/src/sys_driver/BUILD.gn
@@ -10,6 +10,7 @@
     "$magma_build_root/include:msd_abi",
     "$magma_build_root/src/magma_util",
     "$magma_build_root/src/magma_util/platform:buffer",
+    "//zircon/public/lib/fit",
   ]
 
   sources = [
diff --git a/lib/magma/src/sys_driver/magma_driver.h b/lib/magma/src/sys_driver/magma_driver.h
index b574a72..c5c92f3 100644
--- a/lib/magma/src/sys_driver/magma_driver.h
+++ b/lib/magma/src/sys_driver/magma_driver.h
@@ -5,13 +5,15 @@
 #ifndef GARNET_LIB_MAGMA_SRC_SYS_DRIVER_MAGMA_DRIVER_H_
 #define GARNET_LIB_MAGMA_SRC_SYS_DRIVER_MAGMA_DRIVER_H_
 
+#include <lib/fit/function.h>
+
 #include "magma_util/dlog.h"
 #include "magma_util/macros.h"
 #include "msd.h"
 
 #include "magma_system_device.h"
 
-using msd_driver_unique_ptr_t = std::unique_ptr<msd_driver_t, std::function<void(msd_driver_t*)>>;
+using msd_driver_unique_ptr_t = std::unique_ptr<msd_driver_t, fit::function<void(msd_driver_t*)>>;
 
 static inline msd_driver_unique_ptr_t MsdDriverUniquePtr(msd_driver_t* driver)
 {
diff --git a/lib/magma/tests/unit_tests/BUILD.gn b/lib/magma/tests/unit_tests/BUILD.gn
index 47cf1b7..cd56b36 100644
--- a/lib/magma/tests/unit_tests/BUILD.gn
+++ b/lib/magma/tests/unit_tests/BUILD.gn
@@ -38,6 +38,7 @@
     "$magma_build_root/tests/helper:platform_device_helper",
     "$magma_build_root/tests/mock:msd",
     "//third_party/googletest:gtest",
+    "//zircon/public/lib/fit",
   ]
 }
 
diff --git a/lib/ui/gfx/resources/snapshot/snapshotter.cc b/lib/ui/gfx/resources/snapshot/snapshotter.cc
index b492853..a53444d 100644
--- a/lib/ui/gfx/resources/snapshot/snapshotter.cc
+++ b/lib/ui/gfx/resources/snapshot/snapshotter.cc
@@ -4,7 +4,9 @@
 
 #include "garnet/lib/ui/gfx/resources/snapshot/snapshotter.h"
 
+#include <lib/fit/function.h>
 #include <lib/zx/vmo.h>
+
 #include "garnet/lib/ui/gfx/resources/buffer.h"
 #include "garnet/lib/ui/gfx/resources/camera.h"
 #include "garnet/lib/ui/gfx/resources/compositor/display_compositor.h"
@@ -34,7 +36,6 @@
 #include "lib/escher/vk/image.h"
 #include "lib/fsl/vmo/sized_vmo.h"
 #include "lib/fsl/vmo/vector.h"
-#include "lib/fxl/functional/make_copyable.h"
 #include "lib/fxl/logging.h"
 
 namespace scenic_impl {
@@ -87,22 +88,21 @@
   resource->Accept(this);
 
   // Submit all images/buffers to be read from GPU.
-  gpu_uploader_->Submit(
-      fxl::MakeCopyable([node_serializer = current_node_serializer_,
+  gpu_uploader_->Submit([node_serializer = current_node_serializer_,
                          callback = std::move(callback)]() {
-        TRACE_DURATION("gfx", "Snapshotter::Serialize");
-        auto builder = std::make_shared<flatbuffers::FlatBufferBuilder>();
-        builder->Finish(node_serializer->serialize(*builder));
+    TRACE_DURATION("gfx", "Snapshotter::Serialize");
+    auto builder = std::make_shared<flatbuffers::FlatBufferBuilder>();
+    builder->Finish(node_serializer->serialize(*builder));
 
-        fsl::SizedVmo sized_vmo;
-        if (!VmoFromBytes(builder->GetBufferPointer(), builder->GetSize(),
-                          SnapshotData::SnapshotType::kFlatBuffer,
-                          SnapshotData::SnapshotVersion::v1_0, &sized_vmo)) {
-          return callback(fuchsia::mem::Buffer{});
-        } else {
-          return callback(std::move(sized_vmo).ToTransport());
-        }
-      }));
+    fsl::SizedVmo sized_vmo;
+    if (!VmoFromBytes(builder->GetBufferPointer(), builder->GetSize(),
+                      SnapshotData::SnapshotType::kFlatBuffer,
+                      SnapshotData::SnapshotVersion::v1_0, &sized_vmo)) {
+      return callback(fuchsia::mem::Buffer{});
+    } else {
+      return callback(std::move(sized_vmo).ToTransport());
+    }
+  });
 }
 
 void Snapshotter::Visit(EntityNode* r) { VisitNode(r); }
@@ -333,7 +333,7 @@
 
 void Snapshotter::ReadImage(
     escher::ImagePtr image,
-    std::function<void(escher::BufferPtr buffer)> callback) {
+    fit::function<void(escher::BufferPtr buffer)> callback) {
   vk::BufferImageCopy region;
   region.imageSubresource.aspectMask = vk::ImageAspectFlagBits::eColor;
   region.imageSubresource.mipLevel = 0;
@@ -351,7 +351,7 @@
 
 void Snapshotter::ReadBuffer(
     escher::BufferPtr buffer,
-    std::function<void(escher::BufferPtr buffer)> callback) {
+    fit::function<void(escher::BufferPtr buffer)> callback) {
   auto reader = gpu_uploader_->AcquireReader(buffer->size());
   reader->ReadBuffer(buffer, {0, 0, buffer->size()});
   gpu_uploader_->PostReader(std::move(reader), std::move(callback));
diff --git a/lib/ui/gfx/resources/snapshot/snapshotter.h b/lib/ui/gfx/resources/snapshot/snapshotter.h
index 66aab6b..105c77a 100644
--- a/lib/ui/gfx/resources/snapshot/snapshotter.h
+++ b/lib/ui/gfx/resources/snapshot/snapshotter.h
@@ -5,6 +5,8 @@
 #ifndef GARNET_LIB_UI_GFX_RESOURCES_SNAPSHOT_SNAPSHOTTER_H_
 #define GARNET_LIB_UI_GFX_RESOURCES_SNAPSHOT_SNAPSHOTTER_H_
 
+#include <lib/fit/function.h>
+
 #include "garnet/lib/ui/gfx/resources/resource_visitor.h"
 #include "garnet/lib/ui/gfx/resources/snapshot/serializer.h"
 #include "garnet/lib/ui/scenic/scenic.h"
@@ -66,9 +68,9 @@
   void VisitImage(escher::ImagePtr i);
 
   void ReadImage(escher::ImagePtr image,
-                 std::function<void(escher::BufferPtr buffer)> callback);
+                 fit::function<void(escher::BufferPtr buffer)> callback);
   void ReadBuffer(escher::BufferPtr buffer,
-                  std::function<void(escher::BufferPtr buffer)> callback);
+                  fit::function<void(escher::BufferPtr buffer)> callback);
 
   escher::BatchGpuUploaderPtr gpu_uploader_;
 
diff --git a/lib/ui/gfx/screenshotter.cc b/lib/ui/gfx/screenshotter.cc
index bc566b8..7d6de0a 100644
--- a/lib/ui/gfx/screenshotter.cc
+++ b/lib/ui/gfx/screenshotter.cc
@@ -20,7 +20,6 @@
 #include "lib/escher/impl/image_cache.h"
 #include "lib/fsl/vmo/sized_vmo.h"
 #include "lib/fsl/vmo/vector.h"
-#include "lib/fxl/functional/make_copyable.h"
 
 namespace scenic_impl {
 namespace gfx {
@@ -115,13 +114,12 @@
   vk::Queue queue = escher->command_buffer_pool()->queue();
   auto* command_buffer = escher->command_buffer_pool()->GetCommandBuffer();
 
-  command_buffer->Submit(
-      queue,
-      fxl::MakeCopyable([image, width, height, device = escher->vk_device(),
-                         done_callback = std::move(done_callback)]() mutable {
-        OnCommandBufferDone(image, width, height, device,
-                            std::move(done_callback));
-      }));
+  command_buffer->Submit(queue,
+                         [image, width, height, device = escher->vk_device(),
+                          done_callback = std::move(done_callback)]() mutable {
+                           OnCommandBufferDone(image, width, height, device,
+                                               std::move(done_callback));
+                         });
 
   // Force the command buffer to retire to guarantee that |done_callback| will
   // be called in a timely fashion.
diff --git a/lib/ui/gfx/tests/resource_linker_unittest.cc b/lib/ui/gfx/tests/resource_linker_unittest.cc
index 1d57f64..ce0dab2 100644
--- a/lib/ui/gfx/tests/resource_linker_unittest.cc
+++ b/lib/ui/gfx/tests/resource_linker_unittest.cc
@@ -10,7 +10,6 @@
 #include "garnet/lib/ui/gfx/tests/util.h"
 
 #include "lib/fsl/handles/object_info.h"
-#include "lib/fxl/functional/make_copyable.h"
 #include "lib/ui/scenic/cpp/commands.h"
 
 namespace scenic_impl {
@@ -171,39 +170,37 @@
   bool expiry_cb_called = false;
   bool did_resolve = false;
 
-  async::PostTask(
-      dispatcher(),
-      fxl::MakeCopyable([this, &import, &resource, linker, &expiry_cb_called,
-                         &did_resolve,
-                         destination = std::move(destination)]() mutable {
-        // Set an expiry callback that checks the resource expired for the right
-        // reason and signal the latch.
-        linker->SetOnExpiredCallback(
-            [&linker, &expiry_cb_called](
-                Resource*, ResourceLinker::ExpirationCause cause) {
-              ASSERT_EQ(ResourceLinker::ExpirationCause::kExportTokenClosed,
-                        cause);
-              ASSERT_EQ(0u, linker->NumUnresolvedImports());
-              ASSERT_EQ(0u, linker->NumExports());
-              expiry_cb_called = true;
-            });
+  async::PostTask(dispatcher(), [this, &import, &resource, linker,
+                                 &expiry_cb_called, &did_resolve,
+                                 destination =
+                                     std::move(destination)]() mutable {
+    // Set an expiry callback that checks the resource expired for the right
+    // reason and signal the latch.
+    linker->SetOnExpiredCallback(
+        [&linker, &expiry_cb_called](Resource*,
+                                     ResourceLinker::ExpirationCause cause) {
+          ASSERT_EQ(ResourceLinker::ExpirationCause::kExportTokenClosed, cause);
+          ASSERT_EQ(0u, linker->NumUnresolvedImports());
+          ASSERT_EQ(0u, linker->NumExports());
+          expiry_cb_called = true;
+        });
 
-        linker->SetOnImportResolvedCallback(
-            [&did_resolve](Import* import, Resource* resource,
-                           ImportResolutionResult cause) -> void {
-              did_resolve = true;
-            });
-        import = fxl::MakeRefCounted<Import>(
-            session_.get(), 1, ::fuchsia::ui::gfx::ImportSpec::NODE,
-            linker->GetWeakPtr());
-        ASSERT_TRUE(linker->ImportResource(
-            import.get(),
-            ::fuchsia::ui::gfx::ImportSpec::NODE,  // import spec
-            std::move(destination)));              // import handle
+    linker->SetOnImportResolvedCallback(
+        [&did_resolve](Import* import, Resource* resource,
+                       ImportResolutionResult cause) -> void {
+          did_resolve = true;
+        });
+    import = fxl::MakeRefCounted<Import>(session_.get(), 1,
+                                         ::fuchsia::ui::gfx::ImportSpec::NODE,
+                                         linker->GetWeakPtr());
+    ASSERT_TRUE(linker->ImportResource(
+        import.get(),
+        ::fuchsia::ui::gfx::ImportSpec::NODE,  // import spec
+        std::move(destination)));              // import handle
 
-        ASSERT_EQ(1u, linker->NumUnresolvedImports());
-        ASSERT_FALSE(did_resolve);
-      }));
+    ASSERT_EQ(1u, linker->NumUnresolvedImports());
+    ASSERT_FALSE(did_resolve);
+  });
 
   EXPECT_TRUE(RunLoopUntilIdle());
   ASSERT_TRUE(expiry_cb_called);
@@ -261,28 +258,25 @@
   scenic_impl::gfx::ResourcePtr resource;
   bool called = false;
 
-  async::PostTask(
-      dispatcher(),
-      fxl::MakeCopyable([this, &resource, linker, source = std::move(source),
-                         &called]() mutable {
-        resource = fxl::MakeRefCounted<EntityNode>(session_.get(),
-                                                   1 /* resource id */);
+  async::PostTask(dispatcher(), [this, &resource, linker,
+                                 source = std::move(source),
+                                 &called]() mutable {
+    resource =
+        fxl::MakeRefCounted<EntityNode>(session_.get(), 1 /* resource id */);
 
-        ASSERT_TRUE(linker->ExportResource(resource.get(), std::move(source)));
-        ASSERT_EQ(1u, linker->NumExports());
+    ASSERT_TRUE(linker->ExportResource(resource.get(), std::move(source)));
+    ASSERT_EQ(1u, linker->NumExports());
 
-        // Set an expiry callback that checks the resource expired for the right
-        // reason and signal the latch.
-        linker->SetOnExpiredCallback(
-            [linker, &called](Resource*,
-                              ResourceLinker::ExpirationCause cause) {
-              ASSERT_EQ(ResourceLinker::ExpirationCause::kNoImportsBound,
-                        cause);
-              ASSERT_EQ(0u, linker->NumUnresolvedImports());
-              ASSERT_EQ(0u, linker->NumExports());
-              called = true;
-            });
-      }));
+    // Set an expiry callback that checks the resource expired for the right
+    // reason and signal the latch.
+    linker->SetOnExpiredCallback(
+        [linker, &called](Resource*, ResourceLinker::ExpirationCause cause) {
+          ASSERT_EQ(ResourceLinker::ExpirationCause::kNoImportsBound, cause);
+          ASSERT_EQ(0u, linker->NumUnresolvedImports());
+          ASSERT_EQ(0u, linker->NumExports());
+          called = true;
+        });
+  });
   EXPECT_TRUE(RunLoopUntilIdle());
   ASSERT_TRUE(called);
 }
@@ -296,31 +290,28 @@
   scenic_impl::gfx::ResourcePtr resource;
   bool called = false;
 
-  async::PostTask(
-      dispatcher(),
-      fxl::MakeCopyable([this, &resource, linker, source = std::move(source),
-                         &destination, &called]() mutable {
-        // Register the resource.
-        resource = fxl::MakeRefCounted<EntityNode>(session_.get(),
-                                                   1 /* resource id */);
+  async::PostTask(dispatcher(), [this, &resource, linker,
+                                 source = std::move(source), &destination,
+                                 &called]() mutable {
+    // Register the resource.
+    resource =
+        fxl::MakeRefCounted<EntityNode>(session_.get(), 1 /* resource id */);
 
-        ASSERT_TRUE(linker->ExportResource(resource.get(), std::move(source)));
-        ASSERT_EQ(1u, linker->NumExports());
+    ASSERT_TRUE(linker->ExportResource(resource.get(), std::move(source)));
+    ASSERT_EQ(1u, linker->NumExports());
 
-        // Set an expiry callback that checks the resource expired for the right
-        // reason and signal the latch.
-        linker->SetOnExpiredCallback(
-            [linker, &called](Resource*,
-                              ResourceLinker::ExpirationCause cause) {
-              ASSERT_EQ(ResourceLinker::ExpirationCause::kNoImportsBound,
-                        cause);
-              ASSERT_EQ(0u, linker->NumExports());
-              called = true;
-            });
+    // Set an expiry callback that checks the resource expired for the right
+    // reason and signal the latch.
+    linker->SetOnExpiredCallback(
+        [linker, &called](Resource*, ResourceLinker::ExpirationCause cause) {
+          ASSERT_EQ(ResourceLinker::ExpirationCause::kNoImportsBound, cause);
+          ASSERT_EQ(0u, linker->NumExports());
+          called = true;
+        });
 
-        // Release the destination handle.
-        destination.reset();
-      }));
+    // Release the destination handle.
+    destination.reset();
+  });
 
   EXPECT_TRUE(RunLoopUntilIdle());
   ASSERT_TRUE(called);
@@ -336,39 +327,36 @@
   ImportPtr import;
   bool did_resolve = false;
 
-  async::PostTask(
-      dispatcher(), fxl::MakeCopyable([this, &import, &resource, linker,
-                                       source = std::move(source), &destination,
-                                       &did_resolve]() mutable {
-        // Register the resource.
-        resource = fxl::MakeRefCounted<EntityNode>(session_.get(),
-                                                   1 /* resource id */);
+  async::PostTask(dispatcher(), [this, &import, &resource, linker,
+                                 source = std::move(source), &destination,
+                                 &did_resolve]() mutable {
+    // Register the resource.
+    resource =
+        fxl::MakeRefCounted<EntityNode>(session_.get(), 1 /* resource id */);
 
-        // Import.
-        linker->SetOnImportResolvedCallback(
-            [&did_resolve, linker](Import* import, Resource* resource,
-                                   ImportResolutionResult cause) -> void {
-              did_resolve = true;
-              ASSERT_FALSE(resource);
-              ASSERT_EQ(ImportResolutionResult::kExportHandleDiedBeforeBind,
-                        cause);
-              ASSERT_EQ(0u, linker->NumUnresolvedImports());
-            });
+    // Import.
+    linker->SetOnImportResolvedCallback(
+        [&did_resolve, linker](Import* import, Resource* resource,
+                               ImportResolutionResult cause) -> void {
+          did_resolve = true;
+          ASSERT_FALSE(resource);
+          ASSERT_EQ(ImportResolutionResult::kExportHandleDiedBeforeBind, cause);
+          ASSERT_EQ(0u, linker->NumUnresolvedImports());
+        });
 
-        import = fxl::MakeRefCounted<Import>(
-            session_.get(), 2, ::fuchsia::ui::gfx::ImportSpec::NODE,
-            linker->GetWeakPtr());
-        linker->ImportResource(
-            import.get(),
-            ::fuchsia::ui::gfx::ImportSpec::NODE,  // import spec
-            CopyEventPair(destination));           // import handle
+    import = fxl::MakeRefCounted<Import>(session_.get(), 2,
+                                         ::fuchsia::ui::gfx::ImportSpec::NODE,
+                                         linker->GetWeakPtr());
+    linker->ImportResource(import.get(),
+                           ::fuchsia::ui::gfx::ImportSpec::NODE,  // import spec
+                           CopyEventPair(destination));  // import handle
 
-        ASSERT_EQ(1u, linker->NumUnresolvedImports());
+    ASSERT_EQ(1u, linker->NumUnresolvedImports());
 
-        // Release both destination and source handles.
-        destination.reset();
-        source.reset();
-      }));
+    // Release both destination and source handles.
+    destination.reset();
+    source.reset();
+  });
 
   EXPECT_TRUE(RunLoopUntilIdle());
   ASSERT_TRUE(did_resolve);
@@ -381,28 +369,25 @@
   ResourceLinker* linker = resource_linker_.get();
   bool called = false;
 
-  async::PostTask(
-      dispatcher(), fxl::MakeCopyable([this, linker, source = std::move(source),
-                                       &destination, &called]() mutable {
-        // Register the resource.
-        auto resource = fxl::MakeRefCounted<EntityNode>(session_.get(),
-                                                        1 /* resource id */);
-        ASSERT_TRUE(linker->ExportResource(resource.get(), std::move(source)));
-        ASSERT_EQ(1u, linker->NumExports());
+  async::PostTask(dispatcher(), [this, linker, source = std::move(source),
+                                 &destination, &called]() mutable {
+    // Register the resource.
+    auto resource =
+        fxl::MakeRefCounted<EntityNode>(session_.get(), 1 /* resource id */);
+    ASSERT_TRUE(linker->ExportResource(resource.get(), std::move(source)));
+    ASSERT_EQ(1u, linker->NumExports());
 
-        // Set an expiry callback that checks the resource expired for the right
-        // reason and signal the latch.
-        linker->SetOnExpiredCallback(
-            [linker, &called](Resource*,
-                              ResourceLinker::ExpirationCause cause) {
-              ASSERT_EQ(ResourceLinker::ExpirationCause::kResourceDestroyed,
-                        cause);
-              ASSERT_EQ(0u, linker->NumExports());
-              called = true;
-            });
+    // Set an expiry callback that checks the resource expired for the right
+    // reason and signal the latch.
+    linker->SetOnExpiredCallback(
+        [linker, &called](Resource*, ResourceLinker::ExpirationCause cause) {
+          ASSERT_EQ(ResourceLinker::ExpirationCause::kResourceDestroyed, cause);
+          ASSERT_EQ(0u, linker->NumExports());
+          called = true;
+        });
 
-        // |resource| gets destroyed now since its out of scope.
-      }));
+    // |resource| gets destroyed now since its out of scope.
+  });
 
   EXPECT_TRUE(RunLoopUntilIdle());
   ASSERT_TRUE(called);
diff --git a/lib/wlan/mlme/include/wlan/mlme/mac_frame.h b/lib/wlan/mlme/include/wlan/mlme/mac_frame.h
index 2a6930f..9e2d711 100644
--- a/lib/wlan/mlme/include/wlan/mlme/mac_frame.h
+++ b/lib/wlan/mlme/include/wlan/mlme/mac_frame.h
@@ -5,15 +5,15 @@
 #ifndef GARNET_LIB_WLAN_MLME_INCLUDE_WLAN_MLME_MAC_FRAME_H_
 #define GARNET_LIB_WLAN_MLME_INCLUDE_WLAN_MLME_MAC_FRAME_H_
 
-#include <wlan/mlme/sequence.h>
-
 #include <fbl/unique_ptr.h>
+#include <lib/fit/function.h>
 #include <lib/zx/time.h>
 #include <wlan/common/bitfield.h>
 #include <wlan/common/mac_frame.h>
 #include <wlan/common/macaddr.h>
 #include <wlan/mlme/frame_validation.h>
 #include <wlan/mlme/packet.h>
+#include <wlan/mlme/sequence.h>
 #include <zircon/compiler.h>
 #include <zircon/types.h>
 
@@ -274,7 +274,7 @@
 void SetSeqNo(MgmtFrameHeader* hdr, uint8_t aci, Sequence* seq);
 void SetSeqNo(DataFrameHeader* hdr, Sequence* seq);
 
-using MsduCallback = std::function<void(FrameView<LlcHeader>, size_t)>;
+using MsduCallback = fit::function<void(FrameView<LlcHeader>, size_t)>;
 
 // Returns a list of all LLC frames carried in an AMSDU data frame.
 zx_status_t DeaggregateAmsdu(const DataFrameView<AmsduSubframeHeader>&, MsduCallback);
diff --git a/public/fidl/fuchsia.sys/BUILD.gn b/public/fidl/fuchsia.sys/BUILD.gn
index 0962cb0..90384593 100644
--- a/public/fidl/fuchsia.sys/BUILD.gn
+++ b/public/fidl/fuchsia.sys/BUILD.gn
@@ -5,8 +5,6 @@
 import("//build/fidl/fidl.gni")
 
 fidl("fuchsia.sys") {
-  cpp_legacy_callbacks = true
-
   sdk_category = "partner"
 
   sources = [
diff --git a/public/lib/cobalt/cpp/cobalt_logger_impl.h b/public/lib/cobalt/cpp/cobalt_logger_impl.h
index 95da378..3f10a6b 100644
--- a/public/lib/cobalt/cpp/cobalt_logger_impl.h
+++ b/public/lib/cobalt/cpp/cobalt_logger_impl.h
@@ -34,7 +34,11 @@
       : Event(metric_id), event_code_(event_code) {}
   void Log(fuchsia::cobalt::LoggerPtr* logger,
            fit::function<void(fuchsia::cobalt::Status)> callback) {
-    (*logger)->LogEvent(metric_id(), event_code_, std::move(callback));
+    (*logger)->LogEvent(
+        metric_id(), event_code_,
+        [callback = callback.share()](fuchsia::cobalt::Status status) {
+          callback(status);
+        });
   }
   uint32_t event_code() const { return event_code_; }
 
@@ -54,9 +58,11 @@
         count_(count) {}
   void Log(fuchsia::cobalt::LoggerPtr* logger,
            fit::function<void(fuchsia::cobalt::Status)> callback) {
-    (*logger)->LogEventCount(metric_id(), event_code_, component_,
-                             period_duration_micros_, count_,
-                             std::move(callback));
+    (*logger)->LogEventCount(
+        metric_id(), event_code_, component_, period_duration_micros_, count_,
+        [callback = callback.share()](fuchsia::cobalt::Status status) {
+          callback(status);
+        });
   }
   uint32_t event_code() const { return event_code_; }
   const std::string& component() const { return component_; }
@@ -80,8 +86,11 @@
         elapsed_micros_(elapsed_micros) {}
   void Log(fuchsia::cobalt::LoggerPtr* logger,
            fit::function<void(fuchsia::cobalt::Status)> callback) {
-    (*logger)->LogElapsedTime(metric_id(), event_code_, component_,
-                              elapsed_micros_, std::move(callback));
+    (*logger)->LogElapsedTime(
+        metric_id(), event_code_, component_, elapsed_micros_,
+        [callback = callback.share()](fuchsia::cobalt::Status status) {
+          callback(status);
+        });
   }
   uint32_t event_code() const { return event_code_; }
   const std::string& component() const { return component_; }
@@ -103,8 +112,11 @@
         fps_(fps) {}
   void Log(fuchsia::cobalt::LoggerPtr* logger,
            fit::function<void(fuchsia::cobalt::Status)> callback) {
-    (*logger)->LogFrameRate(metric_id(), event_code_, component_, fps_,
-                            std::move(callback));
+    (*logger)->LogFrameRate(
+        metric_id(), event_code_, component_, fps_,
+        [callback = callback.share()](fuchsia::cobalt::Status status) {
+          callback(status);
+        });
   }
   uint32_t event_code() const { return event_code_; }
   const std::string& component() const { return component_; }
@@ -126,8 +138,11 @@
         bytes_(bytes) {}
   void Log(fuchsia::cobalt::LoggerPtr* logger,
            fit::function<void(fuchsia::cobalt::Status)> callback) {
-    (*logger)->LogMemoryUsage(metric_id(), event_code_, component_, bytes_,
-                              std::move(callback));
+    (*logger)->LogMemoryUsage(
+        metric_id(), event_code_, component_, bytes_,
+        [callback = callback.share()](fuchsia::cobalt::Status status) {
+          callback(status);
+        });
   }
   uint32_t event_code() const { return event_code_; }
   const std::string& component() const { return component_; }
@@ -145,7 +160,11 @@
       : Event(metric_id), s_(s) {}
   void Log(fuchsia::cobalt::LoggerPtr* logger,
            fit::function<void(fuchsia::cobalt::Status)> callback) {
-    (*logger)->LogString(metric_id(), s_, std::move(callback));
+    (*logger)->LogString(
+        metric_id(), s_,
+        [callback = callback.share()](fuchsia::cobalt::Status status) {
+          callback(status);
+        });
   }
   const std::string& s() const { return s_; }
 
@@ -166,8 +185,11 @@
         timeout_s_(timeout_s) {}
   void Log(fuchsia::cobalt::LoggerPtr* logger,
            fit::function<void(fuchsia::cobalt::Status)> callback) {
-    (*logger)->StartTimer(metric_id(), event_code_, component_, timer_id_,
-                          timestamp_, timeout_s_, std::move(callback));
+    (*logger)->StartTimer(
+        metric_id(), event_code_, component_, timer_id_, timestamp_, timeout_s_,
+        [callback = callback.share()](fuchsia::cobalt::Status status) {
+          callback(status);
+        });
   }
   uint32_t event_code() const { return event_code_; }
   const std::string& component() const { return component_; }
@@ -193,7 +215,11 @@
         timeout_s_(timeout_s) {}
   void Log(fuchsia::cobalt::LoggerPtr* logger,
            fit::function<void(fuchsia::cobalt::Status)> callback) {
-    (*logger)->EndTimer(timer_id_, timestamp_, timeout_s_, std::move(callback));
+    (*logger)->EndTimer(
+        timer_id_, timestamp_, timeout_s_,
+        [callback = callback.share()](fuchsia::cobalt::Status status) {
+          callback(status);
+        });
   }
   const std::string& timer_id() const { return timer_id_; }
   uint64_t timestamp() const { return timestamp_; }
@@ -218,8 +244,11 @@
            fit::function<void(fuchsia::cobalt::Status)> callback) {
     std::vector<fuchsia::cobalt::HistogramBucket> histogram;
     FXL_CHECK(fidl::Clone(histogram_, &histogram) == ZX_OK);
-    (*logger)->LogIntHistogram(metric_id(), event_code_, component_,
-                               std::move(histogram), std::move(callback));
+    (*logger)->LogIntHistogram(
+        metric_id(), event_code_, component_, std::move(histogram),
+        [callback = callback.share()](fuchsia::cobalt::Status status) {
+          callback(status);
+        });
   }
   uint32_t event_code() const { return event_code_; }
   const std::string& component() const { return component_; }
@@ -242,11 +271,13 @@
            fit::function<void(fuchsia::cobalt::Status)> callback) {
     std::vector<fuchsia::cobalt::CustomEventValue> event_values;
     FXL_CHECK(fidl::Clone(event_values_, &event_values) == ZX_OK);
-    (*logger)->LogCustomEvent(metric_id(), std::move(event_values),
-                              std::move(callback));
+    (*logger)->LogCustomEvent(
+        metric_id(), std::move(event_values),
+        [callback = callback.share()](fuchsia::cobalt::Status status) {
+          callback(status);
+        });
   }
-  const std::vector<fuchsia::cobalt::CustomEventValue>& event_values()
-      const {
+  const std::vector<fuchsia::cobalt::CustomEventValue>& event_values() const {
     return event_values_;
   }
 
diff --git a/public/lib/component/cpp/testing/enclosing_environment.cc b/public/lib/component/cpp/testing/enclosing_environment.cc
index b75716a..73371a6 100644
--- a/public/lib/component/cpp/testing/enclosing_environment.cc
+++ b/public/lib/component/cpp/testing/enclosing_environment.cc
@@ -5,6 +5,8 @@
 #include "lib/component/cpp/testing/enclosing_environment.h"
 
 #include <fuchsia/sys/cpp/fidl.h>
+#include <lib/fit/function.h>
+
 #include "lib/component/cpp/testing/test_util.h"
 #include "lib/fidl/cpp/clone.h"
 #include "lib/fxl/logging.h"
@@ -158,7 +160,7 @@
   }
 }
 
-void EnclosingEnvironment::Kill(std::function<void()> callback) {
+void EnclosingEnvironment::Kill(fit::function<void()> callback) {
   env_controller_->Kill([this, callback = std::move(callback)]() {
     if (callback) {
       callback();
diff --git a/public/lib/component/cpp/testing/enclosing_environment.h b/public/lib/component/cpp/testing/enclosing_environment.h
index c6db7c8..b45b47c 100644
--- a/public/lib/component/cpp/testing/enclosing_environment.h
+++ b/public/lib/component/cpp/testing/enclosing_environment.h
@@ -14,6 +14,8 @@
 #include <fs/synchronous-vfs.h>
 #include <fuchsia/sys/cpp/fidl.h>
 #include <lib/async/default.h>
+#include <lib/fit/function.h>
+
 #include "lib/component/cpp/testing/launcher_impl.h"
 #include "lib/fxl/logging.h"
 #include "lib/svc/cpp/services.h"
@@ -160,7 +162,7 @@
   bool is_running() const { return running_; }
 
   // Kills the underlying environment.
-  void Kill(std::function<void()> callback = nullptr);
+  void Kill(fit::function<void()> callback = nullptr);
 
   // Creates a real component from |launch_info| in underlying environment.
   //
diff --git a/public/lib/component/cpp/testing/fake_launcher.h b/public/lib/component/cpp/testing/fake_launcher.h
index 8717f0a..7736b73 100644
--- a/public/lib/component/cpp/testing/fake_launcher.h
+++ b/public/lib/component/cpp/testing/fake_launcher.h
@@ -2,11 +2,12 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#ifndef LIB_APP_CPP_TESTING_FAKE_LAUNCHER_H_
-#define LIB_APP_CPP_TESTING_FAKE_LAUNCHER_H_
+#ifndef LIB_COMPONENT_CPP_TESTING_FAKE_LAUNCHER_H_
+#define LIB_COMPONENT_CPP_TESTING_FAKE_LAUNCHER_H_
 
 #include <fs/service.h>
 #include <fuchsia/sys/cpp/fidl.h>
+#include <lib/fit/function.h>
 
 #include "lib/fidl/cpp/binding.h"
 
@@ -24,7 +25,7 @@
   FakeLauncher(const FakeLauncher&) = delete;
   FakeLauncher& operator=(const FakeLauncher&) = delete;
 
-  using ComponentConnector = std::function<void(
+  using ComponentConnector = fit::function<void(
       fuchsia::sys::LaunchInfo,
       fidl::InterfaceRequest<fuchsia::sys::ComponentController>)>;
 
@@ -55,4 +56,4 @@
 }  // namespace testing
 }  // namespace component
 
-#endif  // LIB_APP_CPP_TESTING_FAKE_LAUNCHER_H_
\ No newline at end of file
+#endif  // LIB_COMPONENT_CPP_TESTING_FAKE_LAUNCHER_H_
diff --git a/public/lib/escher/fs/hack_filesystem.h b/public/lib/escher/fs/hack_filesystem.h
index 9088ed0..4576516 100644
--- a/public/lib/escher/fs/hack_filesystem.h
+++ b/public/lib/escher/fs/hack_filesystem.h
@@ -10,6 +10,8 @@
 #include <unordered_set>
 #include <vector>
 
+#include <lib/fit/function.h>
+
 #include "lib/fxl/memory/ref_counted.h"
 
 #ifdef __Fuchsia__
@@ -27,7 +29,7 @@
 using HackFilePath = std::string;
 using HackFilePathSet = std::unordered_set<HackFilePath>;
 class HackFilesystemWatcher;
-using HackFilesystemWatcherFunc = std::function<void(HackFilePath)>;
+using HackFilesystemWatcherFunc = fit::function<void(HackFilePath)>;
 
 // An in-memory file system that could be watched for content change.
 class HackFilesystem : public fxl::RefCountedThreadSafe<HackFilesystem> {
diff --git a/public/lib/escher/impl/command_buffer.h b/public/lib/escher/impl/command_buffer.h
index f4f2c84..481b24a 100644
--- a/public/lib/escher/impl/command_buffer.h
+++ b/public/lib/escher/impl/command_buffer.h
@@ -8,15 +8,16 @@
 #include <functional>
 #include <vector>
 
+#include <lib/fit/function.h>
+
 #include "lib/escher/forward_declarations.h"
 #include "lib/escher/renderer/semaphore.h"
 #include "lib/escher/scene/camera.h"
 #include "lib/escher/vk/vulkan_context.h"
-
 #include "lib/fxl/macros.h"
 
 namespace escher {
-typedef std::function<void()> CommandBufferFinishedCallback;
+typedef fit::function<void()> CommandBufferFinishedCallback;
 
 namespace impl {
 
diff --git a/public/lib/escher/paper/paper_shape_cache.h b/public/lib/escher/paper/paper_shape_cache.h
index 4d86f56..32a7e04 100644
--- a/public/lib/escher/paper/paper_shape_cache.h
+++ b/public/lib/escher/paper/paper_shape_cache.h
@@ -8,6 +8,8 @@
 #include <functional>
 #include <vector>
 
+#include <lib/fit/function.h>
+
 #include "lib/escher/forward_declarations.h"
 #include "lib/escher/geometry/types.h"
 #include "lib/escher/paper/paper_renderer_config.h"
@@ -76,7 +78,7 @@
   enum class ShapeType { kRect, kRoundedRect, kCircle };
 
   // Args: array of planes to clip the generated mesh, and size of the array.
-  using CacheMissMeshGenerator = std::function<PaperShapeCacheEntry(
+  using CacheMissMeshGenerator = fit::function<PaperShapeCacheEntry(
       const plane3* planes, size_t num_planes)>;
 
   // Computes a lookup key by starting with |shape_hash| and then hashing the
diff --git a/public/lib/escher/renderer/batch_gpu_uploader.cc b/public/lib/escher/renderer/batch_gpu_uploader.cc
index be6b237..add9ae5 100644
--- a/public/lib/escher/renderer/batch_gpu_uploader.cc
+++ b/public/lib/escher/renderer/batch_gpu_uploader.cc
@@ -4,6 +4,8 @@
 
 #include "lib/escher/renderer/batch_gpu_uploader.h"
 
+#include <lib/fit/function.h>
+
 #include "lib/escher/util/trace_macros.h"
 #include "lib/escher/vk/gpu_mem.h"
 #include "lib/fxl/logging.h"
@@ -257,7 +259,7 @@
 
 void BatchGpuUploader::PostReader(
     std::unique_ptr<BatchGpuUploader::Reader> reader,
-    std::function<void(escher::BufferPtr buffer)> callback) {
+    fit::function<void(escher::BufferPtr buffer)> callback) {
   FXL_DCHECK(frame_);
   if (!reader) {
     return;
@@ -276,7 +278,7 @@
   reader.reset();
 }
 
-void BatchGpuUploader::Submit(const std::function<void()>& callback) {
+void BatchGpuUploader::Submit(fit::function<void()> callback) {
   if (dummy_for_tests_) {
     FXL_LOG(WARNING) << "Dummy BatchGpuUploader for tests, skip submit";
     return;
@@ -298,8 +300,7 @@
                    [callback, read_callbacks = std::move(read_callbacks_)]() {
                      for (auto& pair : read_callbacks) {
                        auto buffer = pair.first;
-                       auto read_callback = pair.second;
-                       read_callback(buffer);
+                       pair.second(buffer);
                      }
                      if (callback) {
                        callback();
diff --git a/public/lib/escher/renderer/batch_gpu_uploader.h b/public/lib/escher/renderer/batch_gpu_uploader.h
index dc64c92..69c16a7 100644
--- a/public/lib/escher/renderer/batch_gpu_uploader.h
+++ b/public/lib/escher/renderer/batch_gpu_uploader.h
@@ -7,6 +7,8 @@
 
 #include <vulkan/vulkan.hpp>
 
+#include <lib/fit/function.h>
+
 #include "lib/escher/base/reffable.h"
 #include "lib/escher/escher.h"
 #include "lib/escher/forward_declarations.h"
@@ -124,7 +126,7 @@
   // the host on Submit(). After submit, the callback will be called with the
   // buffer read from the GPU.
   void PostReader(std::unique_ptr<Reader> reader,
-                  std::function<void(escher::BufferPtr buffer)> callback);
+                  fit::function<void(escher::BufferPtr buffer)> callback);
 
   // The "BatchDone" Semaphore that is signaled when all posted batches are
   // complete. This is non-null after the first Reader or Writer is acquired,
@@ -135,7 +137,7 @@
 
   // Submits all Writers' and Reader's work to the GPU. No Writers or Readers
   // can be posted once Submit is called.
-  void Submit(const std::function<void()>& callback = nullptr);
+  void Submit(fit::function<void()> callback = nullptr);
 
  private:
   BatchGpuUploader(EscherWeakPtr weak_escher, int64_t frame_trace_number);
@@ -165,7 +167,7 @@
   // provide any dummy functionality.
   bool dummy_for_tests_ = false;
 
-  std::vector<std::pair<BufferPtr, std::function<void(BufferPtr)>>>
+  std::vector<std::pair<BufferPtr, fit::function<void(BufferPtr)>>>
       read_callbacks_;
 
   FXL_DISALLOW_COPY_AND_ASSIGN(BatchGpuUploader);
diff --git a/public/lib/escher/renderer/frame.h b/public/lib/escher/renderer/frame.h
index 0a6cc56..ad4c1a4 100644
--- a/public/lib/escher/renderer/frame.h
+++ b/public/lib/escher/renderer/frame.h
@@ -9,6 +9,8 @@
 #include <functional>
 #include <vulkan/vulkan.hpp>
 
+#include <lib/fit/function.h>
+
 #include "lib/escher/base/reffable.h"
 #include "lib/escher/forward_declarations.h"
 #include "lib/escher/impl/command_buffer.h"
@@ -19,7 +21,7 @@
 
 namespace escher {
 
-typedef std::function<void()> FrameRetiredCallback;
+typedef fit::function<void()> FrameRetiredCallback;
 
 class Frame;
 using FramePtr = fxl::RefPtr<Frame>;
diff --git a/public/lib/escher/util/image_utils.h b/public/lib/escher/util/image_utils.h
index 370011d..48785d0 100644
--- a/public/lib/escher/util/image_utils.h
+++ b/public/lib/escher/util/image_utils.h
@@ -27,7 +27,7 @@
     fit::function<void(void*, void*, uint32_t, uint32_t)>;
 #else
 using ImageConversionFunction =
-    std::function<void(void*, void*, uint32_t, uint32_t)>;
+    fit::function<void(void*, void*, uint32_t, uint32_t)>;
 #endif
 
 // Returns the number of bytes per pixel for the given format.
diff --git a/public/lib/escher/vk/vulkan_swapchain_helper.h b/public/lib/escher/vk/vulkan_swapchain_helper.h
index 93075da..be0971a 100644
--- a/public/lib/escher/vk/vulkan_swapchain_helper.h
+++ b/public/lib/escher/vk/vulkan_swapchain_helper.h
@@ -5,6 +5,8 @@
 #ifndef LIB_ESCHER_VK_VULKAN_SWAPCHAIN_HELPER_H_
 #define LIB_ESCHER_VK_VULKAN_SWAPCHAIN_HELPER_H_
 
+#include <lib/fit/function.h>
+
 #include "lib/escher/forward_declarations.h"
 #include "lib/escher/vk/vulkan_swapchain.h"
 
@@ -12,7 +14,7 @@
 
 class VulkanSwapchainHelper {
  public:
-  using DrawFrameCallback = std::function<void(
+  using DrawFrameCallback = fit::function<void(
       const ImagePtr& output_image, const SemaphorePtr& render_finished)>;
 
   VulkanSwapchainHelper(VulkanSwapchain swapchain, vk::Device device,
diff --git a/public/lib/fidl/cpp/interface_ptr_unittest.cc b/public/lib/fidl/cpp/interface_ptr_unittest.cc
index 6d9950b..ffbf8d4 100644
--- a/public/lib/fidl/cpp/interface_ptr_unittest.cc
+++ b/public/lib/fidl/cpp/interface_ptr_unittest.cc
@@ -13,7 +13,6 @@
 #include "lib/fidl/cpp/binding.h"
 #include "lib/fidl/cpp/test/async_loop_for_test.h"
 #include "lib/fidl/cpp/test/frobinator_impl.h"
-#include "lib/fxl/functional/make_copyable.h"
 
 namespace fidl {
 namespace {
@@ -263,8 +262,9 @@
   EXPECT_EQ(ZX_OK, binding.Bind(ptr.NewRequest()));
 
   std::vector<std::string> grobs;
-  ptr->Grob("one", fxl::MakeCopyable([moved = std::move(ptr), &grobs](
-                                         StringPtr s) { grobs.push_back(s); }));
+  ptr->Grob("one", [moved = std::move(ptr), &grobs](StringPtr s) {
+    grobs.push_back(s);
+  });
   EXPECT_FALSE(ptr.is_bound());
   EXPECT_TRUE(grobs.empty());
 
diff --git a/public/lib/fidl/cpp/internal/pending_response.h b/public/lib/fidl/cpp/internal/pending_response.h
index 125a7d8..9ec2793 100644
--- a/public/lib/fidl/cpp/internal/pending_response.h
+++ b/public/lib/fidl/cpp/internal/pending_response.h
@@ -44,9 +44,9 @@
   // called at most once among all the copies.
   //
   // The reason |PendingResponse| objects are copiable is so that they can be
-  // held by an std::function, which is also copyable. Typically, a
+  // held by an fit::function, which is also copyable. Typically, a
   // |PendingResponse| object is held as a member of another object that
-  // implements operator(), which can be wrapped by std::function.
+  // implements operator(), which can be wrapped by fit::function.
   PendingResponse(const PendingResponse& other);
   PendingResponse& operator=(const PendingResponse& other);
 
@@ -77,8 +77,8 @@
 
  private:
   // This class should be small enough to fit into the inline storage for an
-  // std::function to avoid allocating additional storage when processing
-  // messages. Currently, std::function has space for three pointers.
+  // fit::function to avoid allocating additional storage when processing
+  // messages. Currently, fit::function has space for three pointers.
   zx_txid_t txid_;
   WeakStubController* weak_controller_;
 };
diff --git a/public/lib/fsl/socket/blocking_drain.cc b/public/lib/fsl/socket/blocking_drain.cc
index 3ddd782..e5e1b01 100644
--- a/public/lib/fsl/socket/blocking_drain.cc
+++ b/public/lib/fsl/socket/blocking_drain.cc
@@ -4,16 +4,18 @@
 
 #include "lib/fsl/socket/blocking_drain.h"
 
-#include <lib/zx/socket.h>
 #include <vector>
 
+#include <lib/fit/function.h>
+#include <lib/zx/socket.h>
+
 #include "lib/fxl/logging.h"
 
 namespace fsl {
 
 bool BlockingDrainFrom(
     zx::socket source,
-    std::function<size_t(const void*, uint32_t)> write_bytes) {
+    fit::function<size_t(const void*, uint32_t)> write_bytes) {
   std::vector<char> buffer(64 * 1024);
   for (;;) {
     size_t bytes_read;
diff --git a/public/lib/fsl/socket/blocking_drain.h b/public/lib/fsl/socket/blocking_drain.h
index ab0eed0..e685f10 100644
--- a/public/lib/fsl/socket/blocking_drain.h
+++ b/public/lib/fsl/socket/blocking_drain.h
@@ -5,10 +5,11 @@
 #ifndef LIB_FSL_SOCKET_BLOCKING_DRAIN_H_
 #define LIB_FSL_SOCKET_BLOCKING_DRAIN_H_
 
-#include <lib/zx/socket.h>
-
 #include <functional>
 
+#include <lib/fit/function.h>
+#include <lib/zx/socket.h>
+
 #include "lib/fxl/fxl_export.h"
 
 namespace fsl {
@@ -18,7 +19,7 @@
 // socket has been drained, |false| if an error occured.
 FXL_EXPORT bool BlockingDrainFrom(
     zx::socket source,
-    std::function<size_t(const void*, uint32_t)> write_bytes);
+    fit::function<size_t(const void*, uint32_t)> write_bytes);
 
 }  // namespace fsl
 
diff --git a/public/lib/fsl/socket/files.cc b/public/lib/fsl/socket/files.cc
index b29aa4f..d0e377f 100644
--- a/public/lib/fsl/socket/files.cc
+++ b/public/lib/fsl/socket/files.cc
@@ -4,7 +4,6 @@
 
 #include "lib/fsl/socket/files.h"
 
-#include <lib/async/cpp/wait.h>
 #include <stdio.h>
 #include <unistd.h>
 
@@ -13,6 +12,9 @@
 #include <utility>
 #include <vector>
 
+#include <lib/async/cpp/wait.h>
+#include <lib/fit/function.h>
+
 #include "lib/fxl/files/file_descriptor.h"
 
 namespace fsl {
@@ -24,7 +26,7 @@
  public:
   CopyToFileHandler(zx::socket source, fxl::UniqueFD destination,
                     async_dispatcher_t* dispatcher,
-                    std::function<void(bool, fxl::UniqueFD)> callback);
+                    fit::function<void(bool, fxl::UniqueFD)> callback);
 
  private:
   ~CopyToFileHandler();
@@ -35,7 +37,7 @@
 
   zx::socket source_;
   fxl::UniqueFD destination_;
-  std::function<void(bool, fxl::UniqueFD)> callback_;
+  fit::function<void(bool, fxl::UniqueFD)> callback_;
   async::WaitMethod<CopyToFileHandler, &CopyToFileHandler::OnHandleReady> wait_;
 
   FXL_DISALLOW_COPY_AND_ASSIGN(CopyToFileHandler);
@@ -44,7 +46,7 @@
 CopyToFileHandler::CopyToFileHandler(
     zx::socket source, fxl::UniqueFD destination,
     async_dispatcher_t* dispatcher,
-    std::function<void(bool, fxl::UniqueFD)> callback)
+    fit::function<void(bool, fxl::UniqueFD)> callback)
     : source_(std::move(source)),
       destination_(std::move(destination)),
       callback_(std::move(callback)),
@@ -104,7 +106,7 @@
  public:
   CopyFromFileHandler(fxl::UniqueFD source, zx::socket destination,
                       async_dispatcher_t* dispatcher,
-                      std::function<void(bool, fxl::UniqueFD)> callback);
+                      fit::function<void(bool, fxl::UniqueFD)> callback);
 
  private:
   ~CopyFromFileHandler();
@@ -117,7 +119,7 @@
   zx::socket destination_;
   async::WaitMethod<CopyFromFileHandler, &CopyFromFileHandler::OnHandleReady>
       wait_;
-  std::function<void(bool, fxl::UniqueFD)> callback_;
+  fit::function<void(bool, fxl::UniqueFD)> callback_;
   std::vector<char> buffer_;
   size_t buffer_offset_;
   size_t buffer_end_;
@@ -128,7 +130,7 @@
 CopyFromFileHandler::CopyFromFileHandler(
     fxl::UniqueFD source, zx::socket destination,
     async_dispatcher_t* dispatcher,
-    std::function<void(bool, fxl::UniqueFD)> callback)
+    fit::function<void(bool, fxl::UniqueFD)> callback)
     : source_(std::move(source)),
       destination_(std::move(destination)),
       wait_(this, destination_.get(),
@@ -193,18 +195,16 @@
 
 }  // namespace
 
-void CopyToFileDescriptor(
-    zx::socket source, fxl::UniqueFD destination,
-    async_dispatcher_t* dispatcher,
-    std::function<void(bool, fxl::UniqueFD)> callback) {
+void CopyToFileDescriptor(zx::socket source, fxl::UniqueFD destination,
+                          async_dispatcher_t* dispatcher,
+                          fit::function<void(bool, fxl::UniqueFD)> callback) {
   new CopyToFileHandler(std::move(source), std::move(destination), dispatcher,
                         std::move(callback));
 }
 
-void CopyFromFileDescriptor(
-    fxl::UniqueFD source, zx::socket destination,
-    async_dispatcher_t* dispatcher,
-    std::function<void(bool, fxl::UniqueFD)> callback) {
+void CopyFromFileDescriptor(fxl::UniqueFD source, zx::socket destination,
+                            async_dispatcher_t* dispatcher,
+                            fit::function<void(bool, fxl::UniqueFD)> callback) {
   new CopyFromFileHandler(std::move(source), std::move(destination), dispatcher,
                           std::move(callback));
 }
diff --git a/public/lib/fsl/socket/files.h b/public/lib/fsl/socket/files.h
index 03ec2fc..696126f 100644
--- a/public/lib/fsl/socket/files.h
+++ b/public/lib/fsl/socket/files.h
@@ -5,11 +5,12 @@
 #ifndef LIB_FSL_SOCKET_FILES_H_
 #define LIB_FSL_SOCKET_FILES_H_
 
-#include <lib/async/dispatcher.h>
-#include <lib/zx/socket.h>
-
 #include <functional>
 
+#include <lib/async/dispatcher.h>
+#include <lib/fit/function.h>
+#include <lib/zx/socket.h>
+
 #include "lib/fxl/files/unique_fd.h"
 #include "lib/fxl/fxl_export.h"
 #include "lib/fxl/tasks/task_runner.h"
@@ -22,7 +23,7 @@
 FXL_EXPORT void CopyToFileDescriptor(
     zx::socket source, fxl::UniqueFD destination,
     async_dispatcher_t* dispatcher,
-    std::function<void(bool /*success*/, fxl::UniqueFD /*destination*/)>
+    fit::function<void(bool /*success*/, fxl::UniqueFD /*destination*/)>
         callback);
 
 // Asynchronously copies data from source file to the destination. The given
@@ -31,8 +32,7 @@
 FXL_EXPORT void CopyFromFileDescriptor(
     fxl::UniqueFD source, zx::socket destination,
     async_dispatcher_t* dispatcher,
-    std::function<void(bool /*success*/, fxl::UniqueFD /*source*/)>
-        callback);
+    fit::function<void(bool /*success*/, fxl::UniqueFD /*source*/)> callback);
 
 }  // namespace fsl
 
diff --git a/public/lib/fsl/socket/socket_drainer_unittest.cc b/public/lib/fsl/socket/socket_drainer_unittest.cc
index bb70286..703d149 100644
--- a/public/lib/fsl/socket/socket_drainer_unittest.cc
+++ b/public/lib/fsl/socket/socket_drainer_unittest.cc
@@ -4,6 +4,8 @@
 
 #include "lib/fsl/socket/socket_drainer.h"
 
+#include <lib/fit/function.h>
+
 #include "lib/fsl/socket/strings.h"
 #include "lib/gtest/test_loop_fixture.h"
 
@@ -14,8 +16,8 @@
 
 class Client : public SocketDrainer::Client {
  public:
-  Client(std::function<void()> available_callback,
-         std::function<void()> completion_callback)
+  Client(fit::function<void()> available_callback,
+         fit::function<void()> completion_callback)
       : available_callback_(std::move(available_callback)),
         completion_callback_(std::move(completion_callback)) {}
   ~Client() override {}
@@ -30,8 +32,8 @@
   void OnDataComplete() override { completion_callback_(); }
 
   std::string value_;
-  std::function<void()> available_callback_;
-  std::function<void()> completion_callback_;
+  fit::function<void()> available_callback_;
+  fit::function<void()> completion_callback_;
 };
 
 TEST_F(SocketDrainerTest, ReadData) {
diff --git a/public/lib/fsl/tasks/fd_waiter.h b/public/lib/fsl/tasks/fd_waiter.h
index f5f39f8..d0a6cb4 100644
--- a/public/lib/fsl/tasks/fd_waiter.h
+++ b/public/lib/fsl/tasks/fd_waiter.h
@@ -10,6 +10,7 @@
 #include <lib/async/cpp/wait.h>
 #include <lib/async/default.h>
 #include <lib/fdio/unsafe.h>
+#include <lib/fit/function.h>
 #include <zircon/types.h>
 
 #include "lib/fxl/fxl_export.h"
@@ -27,7 +28,7 @@
   // wait failed (e.g., because the file descriptor was closed during the wait),
   // the first argument will be the error code and the second argument will be
   // zero.
-  using Callback = std::function<void(zx_status_t, uint32_t)>;
+  using Callback = fit::function<void(zx_status_t, uint32_t)>;
 
   // Creates an asynchronous, one-shot wait for the given events on the given
   // file descriptor until the given timeout. Calls |callback| when the wait
diff --git a/public/lib/fxl/files/path.cc b/public/lib/fxl/files/path.cc
index a217da5..ab9cd1e 100644
--- a/public/lib/fxl/files/path.cc
+++ b/public/lib/fxl/files/path.cc
@@ -16,6 +16,8 @@
 #include <list>
 #include <memory>
 
+#include <lib/fit/function.h>
+
 #include "lib/fxl/files/directory.h"
 
 namespace files {
@@ -39,7 +41,7 @@
 }
 
 bool ForEachEntry(int root_fd, const std::string& path,
-                  std::function<bool(const std::string& path)> callback) {
+                  fit::function<bool(const std::string& path)> callback) {
   int dir_fd = openat(root_fd, path.c_str(), O_RDONLY);
   if (dir_fd == -1) {
     return false;
diff --git a/public/lib/fxl/functional/bind_callback_unittest.cc b/public/lib/fxl/functional/bind_callback_unittest.cc
index 9aa8182..bdbdea5 100644
--- a/public/lib/fxl/functional/bind_callback_unittest.cc
+++ b/public/lib/fxl/functional/bind_callback_unittest.cc
@@ -3,6 +3,9 @@
 // found in the LICENSE file.
 
 #include "lib/fxl/functional/bind_callback.h"
+
+#include <lib/fit/function.h>
+
 #include "gtest/gtest.h"
 
 namespace fxl {
@@ -28,7 +31,7 @@
 
 TEST(BindCallback, UnwrapNoArgs) {
   int counter = 0;
-  std::function<void()> cb;
+  fit::function<void()> cb;
   {
     SampleBinderClass dummy(counter);
     cb = BindWeakUnwrap(dummy.GetWeakPtr(), [](SampleBinderClass& sender) {
@@ -46,7 +49,7 @@
 
 TEST(BindCallback, UnwrapArgs) {
   int counter = 0;
-  std::function<void(int)> cb;
+  fit::function<void(int)> cb;
   {
     SampleBinderClass dummy(counter);
     cb = BindWeakUnwrap<int>(dummy.GetWeakPtr(),
@@ -65,7 +68,7 @@
 
 TEST(BindCallback, BindWeakSelf) {
   int counter = 0;
-  std::function<void()> cb;
+  fit::function<void()> cb;
   {
     SampleBinderClass dummy(counter);
     cb = BindWeakSelf(dummy.GetWeakPtr(), &SampleBinderClass::incrementBy, 2);
@@ -82,7 +85,7 @@
 TEST(BindCallback, BindWeakPlaceHolder) {
   int counter = 0;
 
-  std::function<void(int)> cb;
+  fit::function<void(int)> cb;
   {
     SampleBinderClass dummy(counter);
 
diff --git a/public/lib/fxl/functional/cancelable_callback.h b/public/lib/fxl/functional/cancelable_callback.h
index 2b1d1c3..14d8e93 100644
--- a/public/lib/fxl/functional/cancelable_callback.h
+++ b/public/lib/fxl/functional/cancelable_callback.h
@@ -7,13 +7,15 @@
 
 #include <functional>
 
+#include <lib/fit/function.h>
+
 #include "lib/fxl/logging.h"
 #include "lib/fxl/macros.h"
 #include "lib/fxl/memory/weak_ptr.h"
 
 namespace fxl {
 
-// CancelableCallback is a wrapper around std::function that allows the
+// CancelableCallback is a wrapper around fit::function that allows the
 // cancellation of a callback. CancelableCallback takes a reference on the
 // wrapped callback until this object is destroyed or Reset()/Cancel() are
 // called.
@@ -46,7 +48,7 @@
  public:
   CancelableCallback() : weak_ptr_factory_(this) {}
 
-  explicit CancelableCallback(std::function<void(Args...)> callback)
+  explicit CancelableCallback(fit::function<void(Args...)> callback)
       : callback_(std::move(callback)), weak_ptr_factory_(this) {
     FXL_DCHECK(callback_);
     BindWrapper();
@@ -65,11 +67,11 @@
   // Returns a callback that can be disabled by calling Cancel(). This returns a
   // null callback if this object currently does not wrap around a callback,
   // e.g. after a call to Cancel() or when in default-constructed state.
-  const std::function<void(Args...)>& callback() const { return wrapper_; }
+  fit::function<void(Args...)> callback() { return wrapper_.share(); }
 
   // Sets |callback| as the closure that may be canceled. |callback| may not be
   // null. Outstanding and any previously wrapped callbacks are canceled.
-  void Reset(std::function<void(Args...)> callback) {
+  void Reset(fit::function<void(Args...)> callback) {
     FXL_DCHECK(callback);
     Cancel();
 
@@ -90,10 +92,10 @@
 
   // The closure that wraps around |callback_|. This acts as the cancelable
   // closure that gets vended out to clients.
-  std::function<void(Args...)> wrapper_;
+  fit::function<void(Args...)> wrapper_;
 
   // The stored closure that may be canceled.
-  std::function<void(Args...)> callback_;
+  fit::function<void(Args...)> callback_;
 
   // Used to make sure that |wrapper_| is not run when this object is destroyed.
   fxl::WeakPtrFactory<CancelableCallback> weak_ptr_factory_;
diff --git a/public/lib/fxl/functional/closure.h b/public/lib/fxl/functional/closure.h
index dc8e032..0594254 100644
--- a/public/lib/fxl/functional/closure.h
+++ b/public/lib/fxl/functional/closure.h
@@ -7,9 +7,11 @@
 
 #include <functional>
 
+#include <lib/fit/function.h>
+
 namespace fxl {
 
-typedef std::function<void()> Closure;
+typedef fit::function<void()> Closure;
 
 }  // namespace fxl
 
diff --git a/public/lib/fxl/functional/make_copyable.h b/public/lib/fxl/functional/make_copyable.h
index 6c780c9..fef5de2 100644
--- a/public/lib/fxl/functional/make_copyable.h
+++ b/public/lib/fxl/functional/make_copyable.h
@@ -7,6 +7,8 @@
 
 #include <utility>
 
+#include <lib/fit/function.h>
+
 #include "lib/fxl/memory/ref_counted.h"
 #include "lib/fxl/memory/ref_ptr.h"
 
@@ -36,23 +38,23 @@
 
 }  // namespace internal
 
-// Provides a wrapper for a move-only lambda that is implicitly convertible to an
-// std::function.
+// Provides a wrapper for a move-only lambda that is implicitly convertible to
+// an fit::function.
 //
-// std::function is copyable, but if a lambda captures an argument with a
+// fit::function is copyable, but if a lambda captures an argument with a
 // move-only type, the lambda itself is not copyable. In order to use the lambda
-// in places that accept std::functions, we provide a copyable object that wraps
-// the lambda and is implicitly convertible to an std::function.
+// in places that accept fit::functions, we provide a copyable object that wraps
+// the lambda and is implicitly convertible to an fit::function.
 //
 // EXAMPLE:
 //
 // std::unique_ptr<Foo> foo = ...
-// std::function<int()> func =
+// fit::function<int()> func =
 //     fxl::MakeCopyable([bar = std::move(foo)]() { return bar->count(); });
 //
 // Notice that the return type of MakeCopyable is rarely used directly. Instead,
 // callers typically erase the type by implicitly converting the return value
-// to an std::function.
+// to an fit::function.
 template <typename T>
 internal::CopyableLambda<T> MakeCopyable(T lambda) {
   return internal::CopyableLambda<T>(std::move(lambda));
diff --git a/public/lib/fxl/strings/string_view_unittest.cc b/public/lib/fxl/strings/string_view_unittest.cc
index 46942f0..9823246 100644
--- a/public/lib/fxl/strings/string_view_unittest.cc
+++ b/public/lib/fxl/strings/string_view_unittest.cc
@@ -6,6 +6,8 @@
 
 #include <functional>
 
+#include <lib/fit/function.h>
+
 #include "gtest/gtest.h"
 
 namespace fxl {
@@ -17,7 +19,7 @@
 // Loops over all substrings of |needles|, and calls |callback| for each.
 void LoopOverSubstrings(
     StringView haystack, StringView needles,
-    std::function<void(std::string haystack_str, StringView haystack_sw,
+    fit::function<void(std::string haystack_str, StringView haystack_sw,
                        std::string to_find_str, StringView to_find_sw,
                        int start_index)>
         callback) {
@@ -37,7 +39,7 @@
 // Loops over all characters in |needles|, and calls |callback| for each.
 void LoopOverChars(
     StringView haystack, StringView needles,
-    std::function<void(std::string haystack_str, StringView haystack_sw, char c,
+    fit::function<void(std::string haystack_str, StringView haystack_sw, char c,
                        int start_index)>
         callback) {
   std::string haystack_str = haystack.ToString();
@@ -53,7 +55,7 @@
 // |callback| for each.
 void LoopOverCharCombinations(
     StringView haystack, StringView needles,
-    std::function<void(std::string haystack_str, StringView haystack_sw,
+    fit::function<void(std::string haystack_str, StringView haystack_sw,
                        std::string current_chars, size_t pos)>
         callback) {
   // Look for all chars combinations, and compare with string.
diff --git a/public/lib/json/json_parser.cc b/public/lib/json/json_parser.cc
index aef4b39..0a2e7d7 100644
--- a/public/lib/json/json_parser.cc
+++ b/public/lib/json/json_parser.cc
@@ -12,6 +12,7 @@
 #include <string>
 
 #include <lib/fit/function.h>
+
 #include "lib/fxl/files/file.h"
 #include "lib/fxl/macros.h"
 #include "lib/fxl/strings/join_strings.h"
@@ -22,7 +23,7 @@
 namespace json {
 namespace {
 
-using ErrorCallback = std::function<void(size_t, const std::string&)>;
+using ErrorCallback = fit::function<void(size_t, const std::string&)>;
 using fxl::StringPrintf;
 
 void GetLineAndColumnForOffset(const std::string& input, size_t offset,
diff --git a/public/lib/json/json_parser_unittest.cc b/public/lib/json/json_parser_unittest.cc
index d7371ee..2d0f475 100644
--- a/public/lib/json/json_parser_unittest.cc
+++ b/public/lib/json/json_parser_unittest.cc
@@ -9,6 +9,8 @@
 #include <functional>
 #include <string>
 
+#include <lib/fit/function.h>
+
 #include "gtest/gtest.h"
 #include "lib/fxl/files/file.h"
 #include "lib/fxl/files/path.h"
@@ -55,10 +57,10 @@
 
   bool ParseFromDirectory(JSONParser* parser, const std::string& dir,
                           std::string* error) {
-    std::function<void(rapidjson::Document)> cb =
+    fit::function<void(rapidjson::Document)> cb =
         std::bind(&JSONParserTest::InterpretDocument, this, parser,
                   std::placeholders::_1);
-    parser->ParseFromDirectory(dir, cb);
+    parser->ParseFromDirectory(dir, std::move(cb));
     *error = parser->error_str();
     return !parser->HasError();
   }
diff --git a/public/lib/ui/sketchy/client/canvas.cc b/public/lib/ui/sketchy/client/canvas.cc
index 25401c3..1a14244 100644
--- a/public/lib/ui/sketchy/client/canvas.cc
+++ b/public/lib/ui/sketchy/client/canvas.cc
@@ -4,8 +4,6 @@
 
 #include "lib/ui/sketchy/client/canvas.h"
 
-#include "lib/fxl/functional/make_copyable.h"
-
 namespace sketchy_lib {
 
 Canvas::Canvas(component::StartupContext* context, async::Loop* loop)
@@ -34,7 +32,7 @@
     // it safe to continue using.
     commands_.clear();
   }
-  canvas_->Present(time, fxl::MakeCopyable(std::move(callback)));
+  canvas_->Present(time, std::move(callback));
 }
 
 }  // namespace sketchy_lib
diff --git a/public/lib/ui/tests/mocks/mock_input_device.cc b/public/lib/ui/tests/mocks/mock_input_device.cc
index 63863c8..74ecda8 100644
--- a/public/lib/ui/tests/mocks/mock_input_device.cc
+++ b/public/lib/ui/tests/mocks/mock_input_device.cc
@@ -11,11 +11,11 @@
     uint32_t device_id, fuchsia::ui::input::DeviceDescriptor descriptor,
     fidl::InterfaceRequest<fuchsia::ui::input::InputDevice>
         input_device_request,
-    const OnReportCallback& on_report_callback)
+    OnReportCallback on_report_callback)
     : id_(device_id),
       descriptor_(std::move(descriptor)),
       input_device_binding_(this, std::move(input_device_request)),
-      on_report_callback_(on_report_callback) {}
+      on_report_callback_(std::move(on_report_callback)) {}
 
 MockInputDevice::~MockInputDevice() {}
 
diff --git a/public/lib/ui/tests/mocks/mock_input_device.h b/public/lib/ui/tests/mocks/mock_input_device.h
index d148c3b..84db4a3 100644
--- a/public/lib/ui/tests/mocks/mock_input_device.h
+++ b/public/lib/ui/tests/mocks/mock_input_device.h
@@ -6,6 +6,8 @@
 #define LIB_UI_TESTS_MOCKS_MOCK_INPUT_DEVICE_H_
 
 #include <fuchsia/ui/input/cpp/fidl.h>
+#include <lib/fit/function.h>
+
 #include "lib/fidl/cpp/binding.h"
 #include "lib/fxl/macros.h"
 
@@ -13,7 +15,7 @@
 namespace test {
 
 using OnReportCallback =
-    std::function<void(fuchsia::ui::input::InputReport report)>;
+    fit::function<void(fuchsia::ui::input::InputReport report)>;
 
 class MockInputDevice : public fuchsia::ui::input::InputDevice {
  public:
@@ -21,7 +23,7 @@
                   fuchsia::ui::input::DeviceDescriptor descriptor,
                   fidl::InterfaceRequest<fuchsia::ui::input::InputDevice>
                       input_device_request,
-                  const OnReportCallback& on_report_callback);
+                  OnReportCallback on_report_callback);
   ~MockInputDevice();
 
   uint32_t id() { return id_; }
diff --git a/public/lib/ui/tests/mocks/mock_input_device_registry.cc b/public/lib/ui/tests/mocks/mock_input_device_registry.cc
index a9b4d6a..dabda6e 100644
--- a/public/lib/ui/tests/mocks/mock_input_device_registry.cc
+++ b/public/lib/ui/tests/mocks/mock_input_device_registry.cc
@@ -8,10 +8,9 @@
 namespace test {
 
 MockInputDeviceRegistry::MockInputDeviceRegistry(
-    const OnDeviceCallback on_device_callback,
-    const OnReportCallback on_report_callback)
-    : on_device_callback_(on_device_callback),
-      on_report_callback_(on_report_callback) {}
+    OnDeviceCallback on_device_callback, OnReportCallback on_report_callback)
+    : on_device_callback_(std::move(on_device_callback)),
+      on_report_callback_(std::move(on_report_callback)) {}
 
 MockInputDeviceRegistry::~MockInputDeviceRegistry() {}
 
@@ -24,7 +23,7 @@
   std::unique_ptr<MockInputDevice> input_device =
       std::make_unique<MockInputDevice>(device_id, std::move(descriptor),
                                         std::move(input_device_request),
-                                        on_report_callback_);
+                                        std::move(on_report_callback_));
 
   MockInputDevice* input_device_ptr = input_device.get();
   devices_by_id_.emplace(device_id, std::move(input_device));
diff --git a/public/lib/ui/tests/mocks/mock_input_device_registry.h b/public/lib/ui/tests/mocks/mock_input_device_registry.h
index f20d061..8b69c02 100644
--- a/public/lib/ui/tests/mocks/mock_input_device_registry.h
+++ b/public/lib/ui/tests/mocks/mock_input_device_registry.h
@@ -9,6 +9,8 @@
 #include <unordered_map>
 
 #include <fuchsia/ui/input/cpp/fidl.h>
+#include <lib/fit/function.h>
+
 #include "lib/component/cpp/startup_context.h"
 #include "lib/fxl/macros.h"
 #include "lib/ui/tests/mocks/mock_input_device.h"
@@ -16,7 +18,7 @@
 namespace mozart {
 namespace test {
 
-using OnDeviceCallback = std::function<void(MockInputDevice*)>;
+using OnDeviceCallback = fit::function<void(MockInputDevice*)>;
 
 class MockInputDeviceRegistry : public fuchsia::ui::input::InputDeviceRegistry {
  public:
diff --git a/public/lib/ui/tests/mocks/mock_view_container_listener.cc b/public/lib/ui/tests/mocks/mock_view_container_listener.cc
index 3047449..2da7d81 100644
--- a/public/lib/ui/tests/mocks/mock_view_container_listener.cc
+++ b/public/lib/ui/tests/mocks/mock_view_container_listener.cc
@@ -13,8 +13,8 @@
 MockViewContainerListener::MockViewContainerListener(
     OnMockChildAttachedCallback child_attached_callback,
     OnMockChildUnavailable child_unavailable_callback)
-    : child_attached_callback_(child_attached_callback),
-      child_unavailable_callback_(child_unavailable_callback) {}
+    : child_attached_callback_(std::move(child_attached_callback)),
+      child_unavailable_callback_(std::move(child_unavailable_callback)) {}
 
 MockViewContainerListener::~MockViewContainerListener() {}
 
diff --git a/public/lib/ui/tests/mocks/mock_view_container_listener.h b/public/lib/ui/tests/mocks/mock_view_container_listener.h
index 62552d3..d52f377 100644
--- a/public/lib/ui/tests/mocks/mock_view_container_listener.h
+++ b/public/lib/ui/tests/mocks/mock_view_container_listener.h
@@ -6,14 +6,16 @@
 #define LIB_UI_TESTS_MOCKS_MOCK_VIEW_CONTAINER_LISTENER_H_
 
 #include <fuchsia/ui/viewsv1/cpp/fidl.h>
+#include <lib/fit/function.h>
+
 #include "lib/fxl/macros.h"
 
 namespace mozart {
 namespace test {
 
 using OnMockChildAttachedCallback =
-    std::function<void(uint32_t, ::fuchsia::ui::viewsv1::ViewInfo)>;
-using OnMockChildUnavailable = std::function<void(uint32_t)>;
+    fit::function<void(uint32_t, ::fuchsia::ui::viewsv1::ViewInfo)>;
+using OnMockChildUnavailable = fit::function<void(uint32_t)>;
 
 class MockViewContainerListener
     : public ::fuchsia::ui::viewsv1::ViewContainerListener {
diff --git a/public/lib/ui/tests/mocks/mock_view_listener.h b/public/lib/ui/tests/mocks/mock_view_listener.h
index 8c00ecc..67af230 100644
--- a/public/lib/ui/tests/mocks/mock_view_listener.h
+++ b/public/lib/ui/tests/mocks/mock_view_listener.h
@@ -6,6 +6,8 @@
 #define LIB_UI_TESTS_MOCKS_MOCK_VIEW_LISTENER_H_
 
 #include <fuchsia/ui/viewsv1/cpp/fidl.h>
+#include <lib/fit/function.h>
+
 #include "lib/fxl/macros.h"
 
 #include <functional>
@@ -14,7 +16,7 @@
 namespace test {
 
 using OnMockViewPropertiesCallback =
-    std::function<void(::fuchsia::ui::viewsv1::ViewProperties)>;
+    fit::function<void(::fuchsia::ui::viewsv1::ViewProperties)>;
 
 class MockViewListener : public ::fuchsia::ui::viewsv1::ViewListener {
  public:
diff --git a/public/lib/ui/view_framework/view_provider_service.h b/public/lib/ui/view_framework/view_provider_service.h
index 530c453..7700877 100644
--- a/public/lib/ui/view_framework/view_provider_service.h
+++ b/public/lib/ui/view_framework/view_provider_service.h
@@ -9,6 +9,8 @@
 #include <vector>
 
 #include <fuchsia/ui/viewsv1/cpp/fidl.h>
+#include <lib/fit/function.h>
+
 #include "lib/component/cpp/startup_context.h"
 #include "lib/fidl/cpp/binding_set.h"
 #include "lib/fxl/macros.h"
@@ -28,7 +30,7 @@
 // A callback to create a view in response to a call to
 // |ViewProvider.CreateView()|.
 using ViewFactory =
-    std::function<std::unique_ptr<BaseView>(ViewContext context)>;
+    fit::function<std::unique_ptr<BaseView>(ViewContext context)>;
 
 // Publishes a view provider as an outgoing service of the application.
 // The views created by the view provider are owned by it and will be destroyed