Mark Carney has been officially sworn in as Canada's 24th prime minister in a ceremony at Rideau Hall, about an hour after Justin Trudeau formally resigned.